Macy's (M -1.03%) stock has lost two-thirds of its value since mid-2015. Some of the stock's decline can be explained by a reduction in the company's earnings over that period. However, most of the drop has come from multiple contraction. This development suggests that investors are worried that Macy's earnings power will decline still further in the coming years.

As Macy's stock has moved lower, a growing number of investors have become interested in the company's real estate. If Macy's real estate is worth more than its entire market value, it would represent a huge safety net for shareholders if the retail business continues to go south. That said, many investors -- such as my Foolish colleague Rich Duprey -- think the decline of mall-based retail will dramatically impair the value of Macy's real estate.

An exterior view of the former Macy's store at Landmark Mall in Alexandria, Virginia

Hundreds of malls are dying because of weak customer traffic. Image source: author.

It's certainly true that some Macy's properties are worth very little. However, the vast majority of Macy's real estate value comes from properties that are likely to hold their value over time.

Real estate at dying malls is losing value

At one end of the spectrum, there are stores in dying malls. Many pundits believe that hundreds of traditional malls will disappear in the next few years, because of changing shopping habits. While Macy's real estate portfolio is better than average, it does have some stores in failing malls.

For example, the company recently tried to auction off its former store in Grand Forks, N.D. The highest bid was under $400,000.

Meanwhile, in Durham, N.C. -- a much more vibrant market overall -- a Macy's store that closed earlier this year won't be retained as retail space. Instead, Macy's sold the store to Duke University, which will renovate the building as a medical center. Despite the lack of interest from retailers, the building still sold for a meaningful sum of $4.5 million.

Downtown stores hold huge value

At the other end of the spectrum, Macy's owns a handful of enormous "downtown" stores in major urban markets. Its two most valuable locations are its flagship stores in Manhattan and San Francisco.

The exterior of the Macy's flagship store in Manhattan

Macy's flagship store in Manhattan is probably worth more than $3 billion. Image source: Macy's.

Analysts at Cowen have estimated the value of the Macy's Manhattan flagship store at $3.3 billion. Investment firm Starboard Value put its value even higher, at $4.0 billion. These valuations seem entirely plausible, given that Lord & Taylor just agreed to sell its Manhattan flagship store for $850 million, and the Macy's building is almost four times as large. (The Macy's flagship store is also a major tourist destination in its own right, which adds to its value.)

Meanwhile, in downtown San Francisco, Macy's recently sold its men's store for about $1,000 per square foot. However, it still owns the main store, which has an even better location (right on Union Square) and has 937,000 square feet of space. This information suggests it would be worth upwards of $1 billion.

Even mall-based stores are valuable -- if they're in the best malls

Macy's flagship stores are particularly important because their value isn't dependent on having malls remain relevant. That said, Macy's mall-based stores are probably worth roughly $10 billion collectively. This may seem surprising, but a large proportion of the value comes from a relatively small number of Macy's best mall-based locations.

While mall traffic has declined significantly in recent years, it has disproportionately hurt the country's worst malls. In fact, the very best malls continue to eke out modest gains in sales per square foot. As less productive malls have fallen by the wayside, it has become more important than ever for fashion brands to put their stores in the best malls.

Space at these malls tends to be quite scarce. Most of the anchor space is taken up by higher-end department stores such as Nordstrom and Saks Fifth Avenue, which aren't about to disappear. As a result, Macy's best mall-based properties should hold their value quite well.

It may be true that a combination of falling mall traffic and store closures will decimate the value of many malls. But that's not where the bulk of Macy's real estate value comes from. As long as most brands continue to seek out the best retail locations to showcase their products, Macy's shareholders can sleep easy, knowing that the company has a valuable trove of real estate assets to support its valuation.