In the late 90's I, like a number of my married friends, 'owned' a house in the Bay Area. Dot coms were going crazy, the economy was insane, and people who got big equity payouts were buying places with their stock. At the height of all that, my Sun stock holdings were enough to pay off the remainder of my mortgage but I got the "opportunity cost" talk from my financial advisor about how tech stocks were returning 15 to 20% and more, so what I should really do, is refinance, and put my equity into tech stock! I didn't do that but at least two people I knew did. And when the crash came, the friends that had refinanced ended up selling their houses an moving out of the area, and I was left with the dread associated of being an "older" engineer when tech jobs were on the way out. But I still had a mortgage and kids to support. Had I paid the house off I would be in a position to take a job with much lower pay than my last job and still stay in my house (with just the tax,insurance,utilities and maintenance costs). The psychological cost of 'uncertainty' is especially burdensome on me (which, I suppose, is why I make a good operations person).
I told my wife that if I ever had a chance to pay off the mortgage again (prior to paying it off the old fashioned way of making payments for 30 years :-)) I would. In California, you are required by law to be able to make a payment larger than you requested payment and any excess goes toward the principal. So we started making bigger payments, and between that and some bonuses and stock recovery we managed to pay it off. I still got complaints from my financial advisor that she could get us a better return than that, but I didn't care. I wanted more certainty than that.
Now that story works because I knew that I wanted to stay in the Bay Area, there were jobs that I would be interested in (even if they didn't pay what I would prefer) and that was important to me. A relative who was more management in retail (started at Sears) found owning was a problem because it made relocation harder. As a result, even though they owned now and then, they lost money during the mortgage crisis (needed to move with their house underwater) and didn't get the advantage of just staying in one place.
My wife's parents simply rented out their place and moved to a new place and bought a new house there. They ended up collecting a few properties which were their retirement plan, being sold off over time to pay for expenses when they could no longer work. That was more 'investment like' in my mind. But it was also a lot of accounting work with property managers etc.
Buying a home works really well if you are married and you both have salaries (and initially no kids). The US tax system is set up to 'reward' that behavior with a better rate for married filing jointly and a mortgage deduction for owning a house. It cuts out a lot of uncertainty. But it also means moving is a bigger deal. In today's market, if you bought a house with an < 6% mortgage and are looking at buying with on >9% then they feel a bit locked in.