After an extremely weak first quarter, Macy's (NYSE:M) began to steady its sales and earnings performance in the second quarter of fiscal 2017. Adjusted comparable store sales fell 2.5% in the period. While that's hardly cause for celebration, it was a big improvement relative to the 4.6% decline that Macy's logged in Q1.

Nevertheless, Mr. Market wasn't impressed. Macy's stock has plumbed new multiyear lows in the past month, even falling below the $20 mark briefly.

M Chart

Macy's Stock Performance, data by YCharts.

Based on its Wednesday closing price of $20.83, Macy's had a meager $6.4 billion market cap. Furthermore, the stock trades for just seven times earnings, based on management's 2017 guidance. This indicates that investors are still underestimating the company's real estate potential.

Macy's sells more real estate

In the first quarter, Macy's realized $96 million of proceeds from asset sales, and booked gains of $68 million related to those deals. More than half of those amounts came from selling the massive Macy's store in downtown Minneapolis.

Macy's made more progress on real estate deals in the second quarter. The company received an additional $54 million in real estate proceeds, bringing it to a total of $150 million year to date. The resulting asset sale gains totaled $43 million.

In contrast to the first quarter, Macy's generated cash from a slew of smaller deals last quarter, as it continued selling real estate related to the 68 stores it has closed in the past year.

For example, Macy's sold its Moorestown Mall store in suburban Philadelphia to mall owner Pennsylvania Real Estate Investment Trust (NYSE:PEI) for $8.9 million. PREIT also bought out the ground lease for the Macy's store at Plymouth Meeting Mall, in Pennsylvania. Meanwhile, Macy's sold the ground lease for its store at CityPlace in West Palm Beach, Florida, for about $7 million.

Guidance for asset sale gains moves higher

Thanks to these real estate sales and a robust pipeline of further deals, Macy's recently raised its asset sale guidance for the year by about $100 million. The company now expects to record $275 million to $300 million of asset sale gains this year, excluding the $235 million gain it will book from the sale of its men's store in downtown San Francisco.

The exterior of the Macy's flagship store in Manhattan

Macy's is steadily selling off excess real estate. Image source: Macy's.

Based on this guidance, asset sale gains will account for about 20% of Macy's profit this year. Many investors view this as a red flag, because asset sale gains are generally considered to be an unsustainable source of earnings and cash flow. However, the market value of Macy's real estate portfolio has been estimated to be as much as $20 billion -- roughly three times its book value. This implies that Macy's could sustain its current pace of asset sales for decades!

Indeed, aside from its portfolio of extremely valuable flagship stores, Macy's controls stores at many of the most productive malls in the U.S. By contrast, most of the stores it has been selling recently are in second- and third-tier malls.

It's interesting to note that mall owners like PREIT are still interested in spending meaningful sums to acquire Macy's stores at these malls. Indeed, PREIT believes that it can improve the value of its properties by buying out department stores like Macy's and replacing them with dining and entertainment options that can drive more traffic to the mall.

Plenty more in the pipeline

Macy's expects to complete a deal this fall to sell two more floors of its downtown Seattle store. Back in 2015, the company netted $65 million for the top four floors of that building.

Macy's is also actively marketing the upper floors of its Chicago flagship store. It currently has far more room than it needs in that building, which contains more than 2 million square feet of space. Depending on how much space Macy's ultimately sells, the proceeds could easily top $100 million, based on recent real estate deals in the area.

Meanwhile, Brookfield Asset Management has started to refine its plans for development projects on up to 50 Macy's properties. This will be a further source of asset sale gains, although the timing will depend on whether Macy's chooses to cash out before or after the redevelopment occurs.

In short, investors still don't seem to appreciate the value of Macy's real estate holdings, even though the company is steadily turning unneeded assets into cash. Considering that Macy's stock yields more than 7% and the department store chain's real estate is probably worth significantly more than the company's current enterprise value, Macy's shares look like a steal right now.