Department stores are shutting hundreds of locations, many of which are anchor tenants in malls.

When the malls lose such huge tenants, they can wind up defaulting on debt that has been bundled with other mall loans into a bond called a CMBS.

Investors are betting against the CMBS like they did before the housing crisis, and shares of mall real-estate investment trusts are also falling fast. Losses on the loans are also causing a pullback in new lending, creating a downward spiral.

One of the biggest waves of retail closures in decades is killing off malls across the US and taking some Wall Street investments with it.

Struggling with online competition, huge retailers like Sears, JCPenney, and Macy's are closing hundreds of stores that typically anchor malls, meaning they occupy the largest spaces at mall entrances and drive most shopper traffic.

When a big store shuts down, it triggers a chain reaction that can end with the shopping mall being unable to collect enough rent to cover its debts, forcing it to default. By one measure, as many as a third of the malls in the US are at risk of facing this situation.

This has become a nightmare for investors who are expecting to collect on those debts. They own bonds — called commercial mortgage-backed securities, or CMBSs — that are backed by the mall properties' rents.

Echoes of the housing crisis

If this sounds familiar, that's because it's similar to one element of the financial crisis. Back then, mortgage-backed securities, which pooled homeowners' mortgages into a multitrillion-dollar financial market, were part of the problem. They encouraged risky lending, and together with derivatives on the bonds that were ginned up by Wall Street, they left banks and investors with massive losses that threatened the financial system.

Nobody is predicting anything that dire today, but CMBSs, which Morgan Stanley says account for nearly 10% of the $3.6 trillion commercial real-estate mortgage market, work similarly. They pool debt payments from several malls or other commercial properties and then splice them so that investors can buy the segment and take on the kind of risk they want.

What's happening in the retail market, though, is worse than anyone who invested in the bonds could've imagined a few years ago.

"Malls are hard to turn around once they go downhill," said Steve Jellinek, vice president of CMBS analytical services for Morningstar Credit Ratings. As a result, many CMBS investments are getting wiped out, and "retail lending has really taken a beating," he said.

About $48 billion in loans backed by mall properties are at risk of default, according to Morningstar.

Jellinek points to Hudson Valley Mall in Kingston, New York, as an example of the domino effect triggered by a mall's demise. The mall's decline was profiled by DeadMalls.com, a site dedicated to dying retail, which says this about its recent history:

"The recent recession and downturn of retail sales as a whole has started to take hold of the mall in rapid succession. Many smaller stores have vacated, and both Buffalo Wild Wings and Friendly's (a staple since the mall opened) have left. The big blows came when both JCPenney and Macy's shuttered in 2015 and 2016, respectively. Sears and Target remain as the only major anchors, along with Best Buy and Dick's, but they have not been enough to draw traffic."

The mall defaulted on its $49.1 million loan in 2015 and was put into receivership last summer, according to the Daily Freeman, a newspaper based in Kingston. In January, it was sold for $9.4 million, a fraction of the property's $66 million assessment.

Jellinek says this kind of fire sale is common with distressed mall properties.

"A lot of times, these malls decrease in value so fast," he said. "There is very little the servicer can do to maintain the value once tenants start leaving."

The CMBS that backed the property took a hit worth $42 million. In this scenario, the lowest class of bondholders will likely end up empty-handed. It could also affect the second and third classes of investors from the bottom.

REIT pain

It's not just the debt market that's taking a hit. Real-estate investment trusts that own the malls are suffering, and investors are being advised to avoid them.

For example, in a lengthy research note discussing the real-estate market, Morgan Stanley identified CBL & Associates as a "highest conviction underweight recommendation," citing "elevated risk from lease modifications and store closures."

Markets Insider CBL was managing the Hudson Valley Mall, a job that required it to find new tenants for the empty space. Its shares are down more than 50% over the past two years.

CMBS heyday

Ten years ago, before the recession, retail investments appeared much rosier, and CMBS loans skyrocketed.

"Lenders were falling over themselves to make loans on mall properties," and their terms were overly optimistic in expecting revenue to improve, Jellinek said. "When the economy went into the dumpster, cash flow fell, and that led to outsized losses."

Now, Morningstar expects CMBS lending overall to drop about 15%, from $70 billion last year to $60 billion this year.

Not everyone is suffering. As with the residential-mortgage crisis, some investors, like Jason Mudrick of the $1.6 billion Mudrick Capital Management, have been betting on the decline in CMBS by shorting some securities.

"This is a forever trend," he told Bloomberg, referring the retail industry's struggles. "When you think about how things are going to look 10 years from now or 20 years from now, our parents will be dead, our kids will be adults — you think more people are going to be shopping online or less? This is the Amazon effect, and it's here forever."

Not all malls are under threat. The industry categorizes malls by their location and the quality of their anchors.

Class A malls — those in wealthy areas with high occupancy rates and upscale anchors such as Nordstrom and Neiman Marcus — are doing fine. But class B malls and those in the C and D territories are at risk of default.

The real-estate research firm Green Street Advisors estimates that 30% of all malls fall under the C and D classifications. That means at least a third of shopping malls are at risk of dying off.

"This year will be the year of retail bankruptcies," Corali Lopez-Castro, a bankruptcy lawyer, told Business Insider after she attended a recent distressed-investing conference in Palm Beach, Florida. "Retailers are running out of cash, and the dominoes are starting to fall."