@Eunos_Cosmo
On the subject of housing as a financial instrument... it's so damned complicated.
The stock market is based on almost nothing. There is a floor to the price of stocks that is upheld by the ability to purchase the company in a hostile takeover, and the ability of the company to offer a dividend. For a company that does not post a profit, that second one may be nil. Other than that, and the actual yield on the price of the stock (dividend), stock is speculation.
Housing offsets rent. Although the cost of repairs and property tax might eat into the offset by a good bit. It also comes with a great deal of luxury that renting simply does not. You (for the most part) get to stop moving, stop chasing a better rental situation, know that at the end of your lease term you're not dealing with a huge increase in rent, or a landlord that no longer wishes to rent and kicks you out (this happened to me). You can customize the property, and this is unbelievably satisfying. So there are a lot of non-financial benefits to owning, but primarily owning the house offsets rent.
You can speculate on the price of housing (like stocks), although housing is a significantly less volatile market than stocks, so the speculation game is a good bit more boring. I think right now is actually a decent time to be speculating though, and while I don't see a big potential for drastic price increases broadly in the US, I do see potential for some negative movement. One other consideration is that housing is a bit like gold, but more like how people think of gold than gold actually is. Gold tends to be fairly volatile, people flood to it when times are tough thinking it's safe. But the price of gold is wildly speculative, whereas housing has more immediate utility and a fair amount of "stick" when it comes to the ability to sell it in a panic or buy it in a panic. As a result, a house is "real" gold if you will. Also you can insure it (I hope you included home insurance in your calculations... earthquake insurance in CA is going to kill you if you get it, or not, either way). So housing is a great hedge against inflation.
So that's housing. There are some niches for housing, like specialized rental markets, and new construction. But that's fairly broad brush, and you should probably think of it in those terms. If you're going to compare the financial benefits of housing against opportunity cost of money in the stock market, you're almost necessarily speculating on the price of the market, and you should probably expect the market to go down... any day now... seriously why is it still going up?
If nothing else, you could consider it a diversification of your portfolio.
Now let's consider a mortgage, which is a financial instrument in and of itself and should be decoupled (as much as possible) from the actual decision to purchase the house. A mortgage is just a long term loan which might have some favorable tax treatment. Right now mortgage rates are at all-time lows, and those rates are down around near where inflation typically sits. Meaning over the life of a 30 year loan you might expect that mortgage to cost you $0 in terms of real buying power. Ever year you kick in your 3% of interest, and every year the mortgage is worth 3% less in purchasing power because of inflation.
To take a real world example, let's say you have a $100k downpayment saved up. Inflation occurs this year at 3%. Your purchasing power is now $97k. You've lost $3k in purchasing power. Let's say you took your $100k downpayment and bought a house with it. Now your purchasing power at the end of the year is $100k. You've lost $0 in purchasing power. Now let's imagine that you leverage your money into property via a mortgage. So you buy $600k worth of house with your $100k downpayment and owe $500k at 3% interest. At the end of the year your $500k is a net zero (inflation eats away at it at a rate equal to the interest). Your $100k downpayment is still worth $100k, so you've lost zero. But wait we're not done. Because you bought a house with it. A house that is worth another $500k and is ALSO a hedge against inflation. The house itself is worth another $515k at the end of the year. Meaning you've gained $15k in purchasing power.
You started with $100k. You end with $500k in debt (interest on debt balancing inflation), and gained $515k in house. Net gain, $15k.
Let's run it for 6% inflation. Your downpayment is net zero. Your mortgage is net $15k (because it lost value at a rate greater than inflation), and your house is net $30k. So you've gained a total of $45k compared to not investing your $100k in anything (edit: actually I think that's $51k on re-thinking the numbers), a return of 45% in a single year.
Let's run it for 3%
deflation. Your downpayment is net zero again. This is because we're presuming that the value of the house tracks deflation and inflation perfectly. Meaning since you've converted your downpayment into a fraction of house, it changes in purchasing power by zero, it still buys the same amount of house. The mortgage actually gains 3% in value and costs you 3% interest. Meaning a total of 6% cost in purchasing power on your $500k of debt. So you lose $30k. Additionally, the rest of the house loses value, so you've lost
another 30k. For a total loss of $60k.
I've completely ignored a 2nd order of detail of this calculation, and I'm fine with that.
Basically, a mortgage allows you to leverage yourself into property using borrowed money, and that gives you a much larger lever arm against inflation, and gives deflation a much larger lever arm against you. Right now, some deflation seems to be occurring, but it's not expected to last long.