To be fair, they're great to live in. However, if you are purchasing for the purpose of making money, there are far better and frankly easier ways to do so (namely, good ol' stocks and bonds). The historical record of house price appreciation is quite poor. Taken from the Wikipedia article on the Case-Shiller index, the best-known house price index (Shiller won the Nobel Prize in Economics for his "empirical analysis of asset prices", so he knows a thing or two about this stuff):
Robert Shiller draws some key insights from his analysis of long term home prices in his book Irrational Exuberance. Contrary to popular belief, there has been no continuous uptrend in home prices in the US and the home prices show a strong tendency to return to their 1890 level in real terms. Moreover, he illustrates how the pattern of changes in home prices bear no relation to changes in construction costs, interest rates or population.
Shiller notes that there is a strong perception across the globe that home prices are continuously increasing, and that this kind of sentiment and paradigm may be fueling bubbles in real estate markets. He points to some psychological heuristics that may be responsible for creating this perception. He says that since homes are relatively infrequent purchases, people tend to remember the purchase price of a home from long ago and are surprised at the difference between then and now. However, most of the difference in the prices can be explained by inflation. He also discusses how people consistently overestimate the appreciation in the value of their homes. The US Census, since 1940, has asked home owners to estimate the value of their homes. The home-owners' estimates reflect an appreciation of 2% per year in real terms, which is significantly more than the 0.7% actual increase over the same interval as reflected in Case–Shiller index.
0.7% real return is absolutely terrible. However, if you think Shiller's analysis is flawed due to its 120 year time horizon (perhaps you don't believe the 1800s or early 1900s is relevant to today's investment environment), take a look at the data over a more recent period. Over the last 30 years (1987-2017), the Case-Shiller US national house price index has appreciated 3.6% per year. Considering that headline CPI inflation has averaged 2.6% over the same period, this means that the average home has delivered 3.6-2.6=1.0% real return. Wow, that's not that much better!
In comparison, the S&P 500 has returned 7.3% per year, which is a 7.3-2.6=4.7% real return. That is almost 5x as much return as the average home! You would need to borrow 80% against your house value to realize that return, which is in fact, what many people do (i.e. get a mortgage with 20% down). However, stocks can deliver that return with NO leverage (a fancy word for debt), which is an incredibly valuable thing (after all, who wants to be indebted?).
High fees. The average round-trip broker fee in the US is commonly quoted as 6%, and for the lack of better data, I will use this number**. With 1.0% real return, it takes you six years to break even on your house investment! In comparison, the bid-ask spread on the iShares S&P 500 ETF (IVV) is about 1 cent, which is about 0.004%. The annual expense ratio is 0.04%. Thus, a six year investment in stocks costs about 0.244%, which looks a lot nicer than the exorbitant 6% on houses.
A standard refrain to this argument is the assertion that although stocks return more, they are way more risky than houses. It is true that in investing, we don't look at return by itself, we generally consider return per unit of risk. Well, going back to the data...
Looking at the max drawdown* (the difference from peak to trough), it is about -53% for stocks, which occurred during the '07-'09 financial crisis. Thus, in the worst case scenario, you can expect to lose about half the value of your stock holdings. How about houses? Their max drawdown was 26% of their value, so you can expect to lose about a quarter of your house's value.
Thus, stocks have 2x the risk while delivering 5x the return as an un-levered house investment. Not a bad trade-off in favor of stocks! Even with leverage, this analysis doesn't change - in fact, leverage creates even more issues. If you borrowed 80% against your home, and your house goes down -20% in value, that essentially wipes out your homeowner's equity. Any more than 20% and you actually have negative equity. In that case, it makes sense for you to walk away from your debts and just not pay, since there is no recoverable value for you to realize. This is NOT a hypothetical scenario - this is exactly what led to the '07-'09 financial crisis in the first place.
Illiquidity. Houses tie up your capital. Liquidity is defined as how quickly you can transform an investment back into cash. If you have a sudden need for cash, you can sell your stock holdings this very second. On the other hand, houses typically take months and even years to sell at a fair market price (which, unlike stocks, is not known to you). Thus, you can easily turn a liquidity problem into a solvency problem.
Lack of timely, accurate information and transparency. There is no surefire way of ascertaining the value of your home. You can't go on Bloomberg / Yahoo / Google and look up the price of your specific home. While there are certain online tools (Trulia, Zillow) those are merely estimates; there is no guarantee that you can get that price when you sell. The only way to know for sure is go through the cat-and-mouse game of listing, appraisal, negotiating with brokers (who have their own disparate incentives), weighing serious offers, etc. With such a large asset (and corresponding liability if you have a mortgage) on your balance sheet, this introduces significant uncertainty to your net worth calculations. If you don't have an accurate idea of your wealth, how can you make wise financial decisions, such as allocation to consumption and savings?
No power of diversification. Finally, unless you have access to significant amounts of capital or leverage, there is no easy way to diversify your housing investments (although with the advent of home price futures, this may change). Even if you do, you still have the pitfalls listed above of very low real returns, high fees, illiquidity, informational uncertainty as well as the standard problems of leverage.
Now, whether it makes sense to purchase a house to live in is a totally separate consideration requiring a very different type of analysis (consideration of the rental market, etc.). If you know you are going to live in the same house in the same location for 20, 30 or more years, many of these issues simply don't matter. Anything shorter than that time horizon, however, requires a long, hard look at the considerations listed above.
*Why not look at volatility (standard deviation of returns) as a measure of risk? Since there is no good way to do high-frequency, mark-to-market pricing of house prices due to illiquidity (how often is a given house bought and sold? not that often!), I would argue that volatility as a risk measure doesn't really work for houses. Thus, I prefer to use max drawdown.
**Some people argue that since only the buyer pays (or the converse argument, only the seller pays) the correct number is half, or 3%. This leads to an incorrect analysis, since any evaluation of investment return net of fees needs to consider the round-trip transaction (purchase and sale). Otherwise, you're not talking about realized returns.