Another nice thing about owning a home is you can improve it (additions, adding bathrooms, etc) and certain additions more or less pay for themselves in terms of "getting your money back" over enough time. Again, probably not going to outperform the market, but you get to live in it. So even if the market tanks for a few years, I still get the benefits of whatever I've invested in my home.
The trick is to not overspend on a home. Too many people use all their savings to make a downpayment and then use too much of their income to pay for it. This can not only get you in trouble but also puts you at a serious disadvantage in terms of accumulating wealth.