One thing to not forget is the amount of leverage provided for you in the housing market is disproportionate compared to the leverage you would get in stocks (20% down is 5x leverage, and there are some options to get in on a house with even less than that).
If you look at the real rate of return on everything (paper from 2017, analyzing the period between 1870 and 2015 in several developed countries), they claim the return on property is around 8% per year, which is comparable to stocks but with a lower variance.
A caveat though is that housing outperformed equity slightly 1870-1950, and equity has outperformed 1950-today. Housing is also a very locale-specific thing, since there is no global private 'housing' market you can invest in.