If it seems baffling that the major stock market measures like the S&P 500 are still close to their all-time highs in what sure looks like a brutal recession, just take a glance at the housing market, where prices only seem to go up.

Median housing prices in the Twin Cities increased 4.9% in May, according to real estate firm Zillow, the continuation of a trend here that has been consistently sloping up since the end of 2011.

The firm’s outlook is for more appreciation, too.

Falling interest rates — down to around 3% for 30-year mortgages — helps spur demand, of course. They make a higher-priced house easier to pay for.

There’s also a lot less inventory in the market now, with for-sale listings down more than 20% in the Twin Cities compared to last year.

Yet the biggest factor was confirmed by Zillow economist Jeff Tucker, and that there’s a structural change in the market driving prices higher. A big generation of Americans, the millennials, have gotten to their peak homebuying years at a time when there has been more than a dozen years of underinvestment in for-sale housing.

That was the story of the housing market just before the coronavirus pandemic, Tucker said, and it remains the story now six months in.

Millennials are roughly 24 to 39 years old, and as a group passed the baby boomers in size in 2019. The millennial generation is more than 70 million strong, roughly 6 or 7 million more people than Gen X, which preceded it. Potentially a lot more of them will want to be homeowners.

Even the oldest millennials were just starting out in adult life during the last recession, in 2008 and 2009, a downturn shaped in part by a collapse in the housing market.

After the air left the housing bubble in the 2000s, the low point in prices here was reached at the end of 2011, again according to Zillow. That was about two and a half years after the economy finally started growing again after the Great Recession.

This brutal downturn in the housing business was so bad that for years every snippet of news about housing alluded to the “recovery” in the market. Builders and skilled workers were looking forward to better days, too, not just homeowners looking to see their house get back to a value that exceeded their mortgage balance.

A boom and bust cycle in a cyclical industry like housing, though, doesn’t always take place in a short period of time. This one unfolded over years.

You can see what has happened in a closely watched figure called residential fixed investment, largely made up of new construction and renovation of housing. For decades, this total investment bumped along at about 4 or 5% of gross domestic product. In the 10 years ending in 2006, though, the average ticked up, peaking one year at close to 7%.

That’s kind of what you would expect, knowing that there was a housing boom underway in that period fueled by readily available financing and an assumption that housing prices would only go up.

In the years since the cycle turned, though, the level of investment still hasn’t climbed back into its more or less normal range. Residential fixed investment, in the worst year, rounded to 2%.

“There are deep stories behind that in America,” Tucker said. “Part of it was maybe that the easy to build land really close to cities kind of got used up. To some extent a lot of it is regulations, zoning, or just different ways it’s become harder to build than it used to be. But also … the industry really got hammered in the Great Recession and just lost a lot of people who know how to build houses.”

What has happened since the beginning of the pandemic this year isn’t exactly a normal recession. Because just staying home makes so much sense with a pandemic underway, decisions on where to live have become even more important.

About 3 million young adults so far have apparently moved back in with their parents or grandparents, Tucker pointed out, although they might not be simply trying to save money. Many are likely still employed but have decided to go through this year of crisis with their families.

Homeowners, on the other hand, are staying put if they can. One explanation for the dearth of new listings is that older homeowners planning to move this year have put that off, although Tucker said he isn’t aware of data to confirm that.

Another unusual feature of this recession holding down new listings, he said, is that about 8% of mortgages already have entered into some form of forbearance, meaning an agreed-to pause or reduction of payments. That’s one indication of just how painful this downturn is already.

And another wave of foreclosures could rise, along with a surge in homelessness.

While Tucker said forbearance is “good public policy” and good for homeowners, ordinarily people under the gun financially would be motivated to list their houses to sell, hoping to get out from under their mortgage debt.

All this has been enough to push the median price in the Twin Cities to about $287,000, according to Zillow, up from $164,000 at the trough of the market in 2011, although it’s always challenging when looking at a price information over time to know if it really compares apples to apples. The Minneapolis Area Realtors, for instance, earlier this month put the median home price at $305,000.

Either way, there has been a very big move upward in housing values, greater than 50% over the decade after adjusting for inflation. By now you have maybe already guessed that inflation-adjusted average hourly wages have not increased nearly as much since then, up only about 11%.

As for what happens to homeownership affordability as the pandemic continues, at this point it’s hard to imagine how it soon gets much easier.