* Leverage. (The most you can leverage a stock investment is 2x. For homes people can leverage their money up to an insane 20x, for example: by buying a 500k home with 25k down. The proper comparison is not to compare buying a 500k home vs 500k worth of stocks; it's buying 25k or 50k worth of stocks vs a 500k home.)
* Mortgage deduction. (Imagine if you could invest 500k in the stock market with only 25k, and then the government let you deduct your interest payments!)
* Inflation. (I've heard of people living in Manhattan in apartments they bought in the 1980s that pay a mortgage of $500. Inflation has reduced their mortgage debt to negligible levels. Time has in a very real way erased much of their debt.)