Probably a bit strong of a word, but speaking broadly it’s rare when real estate retreats in value. I say this as someone who walked away from an underwater property after the 2008 GFC. Yes, property sometimes loses value in black swan events or in specific regions, but on average at the macro level it keeps up with inflation.
Population is growing and the earth is still the same size. The number places you can build a new home is shrinking and more people want a home - so prices will tend to go up. So it’s usually a safe bet to say home prices will only go up.
Multiply this principle by the “attraction to city amenities” and the “acceptable travel time”.
The number of places to build a new home proximate to food and leisure is limited and creates this effect near cities. Drive into the country, and there are plenty of remaining 0.1 acre plots available for cheap.
If self-driving cars substantially affect the cost of transportation time, we could see another epic flight further and further from cities, which would hold housing prices down for a long time.
AIUI, investing in the stock market has a higher expected return with similar risk over a 30 year period.
Owning a home is putting a large portion of your net worth into a single asset. From an investment perspective, that goes against the central principle of portfolio management: diversified risk.
Everyone needs a place to live, and most people aren’t going to move frequently enough where renting would be a superior option (excluding specific outlier markets like SF and parts of NYC). The mortgage interest deduction isn’t terribly generous, but property taxes usually provide for an exemption if you’re an owner versus renting. We subsidize home ownership heavily in the US.
I’m not arguing you should treat your home as an investment primarily, but if you own or plan to, recognize it for what it is, another asset in your portfolio.
Also, I have a comment in this thread where I point out that future market returns are expected to be on par with your mortgage rate; paying your mortgage down would be a better return than investing if those predictions hold true.