As they say it is complicated, and depends on many factors. The investment companies always get their money, but do you. I have put money into 401/403B accounts for 30+ years, and contrary to the money doubling every 7 years, they are worth about 2X what I put into them. I have weathered portfolio drops of 30% and then had to wait many years for it to come back. As you get older you move toward more capital preservation, I may not have another 10 years for it to come back. Hindsight is great, sure I could have invested in the stock market and doubled my money, but for every one person who reaps the highs there are probably 10 people who have paid for it. As you get older your risk factor changes, I have had this discussion with our financial investors for the last 30 years. Sure I want to make more money, but I am 66 my wife is 70, do I really want to risk a big chuck of retirement savings playing the market and waiting another decade for it to come back.
We have always made money on houses and land, but usually it was because we bought at a low and sold at close to a high. So it is a timing game and depends on your income and how fast you can pay it down. I personally think it is foolish to get a 30 year loan and pay almost all interest for the first 15 years. One can also increase payments as wages go up, so you are not paying down the house until you are in the grave. Same goes for 2nd mortgages, in particular people who feel it is free money, my house is worth more. We have also had rental property through the years which helped pay down that house and/or provide an income stream. As we got older we no longer wanted to deal with renters, let alone get shafted by the city of San Francisco, and got out of there.
As you get older and if you have limited income streams, and or not diversified with different sources of income, then I feel owning your house is a much wiser choice then paying 2-3K a month for mortgage/rent on top of all the other costs. There is also comfort in knowing that you owning a house vs. renting. Return on investment for 400K might get you 2-3% these days in somewhat protected investments, 0.4% in a "high yield" savings account. You might be able to go out to dinner once or twice a month on the interest. Stock market, once you are retired is more like Russian Roulette with one blank chamber. My recommendation depends on where you want to live and current housing market prices, if they are high, rent or travel for awhile until the prices go down, and you do not need to worry about interest rates. Last two homes we have owned we came in with cash at times when the market was soft, and we dictated the price/terms. Now, is a bad time to buy a house in many markets, but the feeding frenzy is ebbing, As Dave mentioned if the stock market get the jitters, or takes a tumble, so will the housing market.
Last but not least, one needs to think about inflation over the years, and what that means/impacts you. If you own nothing, you will always be paying more for everything/living expenses which will go up and more than you might expect. If you own everything inflation only impacts those items you need to live on, so food and utilities (energy, water, etc.), as a percentage of total spend the impact of inflation is much less on your run costs as long as you do not spend like crazy on consumer goods. If you own your house, and you plan to stay, then owning the house just eliminates those run costs for years to come. It doesn't really matter as to the value of the house long term, as you plan to stay. Also do not do a reverse mortgage, you will regret it.
We own our house, I have a 9kW solar system, so electricity is paid for and I have enough reserve for and EV if I go that route at some point. We live in north county San DIego, so heating costs are minimal, house taxes are the biggest expense, but at least I know they will stay relatively constant in future years (when we lived in Tucson, AZ they went up 20% in one year). I been driving the same truck for 15 years, and wife owns her car and plans to keep hers for 10-15 years. I do almost all the maintenance and repairs, so we pay for food, gas and water. We have disposable income, but we are not big material consumers. I have multiple sources of income, and if needed I could loose one source and we would still be comfortable and have no worries. Why risk the money in the market at this point, I am more into capital preservation with consistent appreciation at 3-7%.
Mark