Robert Shiller won a nobel prize in economics for essentially saying that the value of a house over the long run, will track the rate of inflation. This makes sense because if it outpaced inflation long enough nobody could afford a house, and if it was under the inflation rate long enough houses would be so cheap that everyone would be able to afford one.
If we assume an average inflation rate of 3%, that means a 100k house will be worth 103k next year, and 106,900 the year after. Obviously prices don't increase uniformly each year, some years the price may go up, some years it may go down, but if we track the prices long enough, by definition the price will trend to the average unless there are outside factors involved (Detroit collapsing, or the shifting demographics away from the midwest and towards the coastal and southern regions). Since we often talk about owning real estate for multiple decades, it is relatively safe to say that the end price will likely be relatively close to it's predicted value.
Similarly a casino isn't going to let someone walk up to the roulette table and bet $10 million on black because the risk is way too high, but they are more than happy to let you place ten million different bets of $1. The more often an event occurs the more its outcome tracks to the average. The more years we track our home value, the closer that value will come to it's anticipated value.
Therefore if we take our 100k home with a 20% downpayment, in a perfect world it would be worth 103k next year and we would owe roughly 79k on it. This is 4k spread which is a 20% return on investment. This, combined with tax advantages is a pretty decent return on investment even if our cashflow is strictly breaking even.
Furthermore, it can be assumed that if inflation is 3%, that annual rent rates will also rise at roughly 3% per year. This turns a break even 1k/month rental into a place that cashflows +100 after 3 or 4 years.
While I would never advocate purchasing a strictly cashflow neutral home as you can probably find a better deal out there somewhere, the fact remains that even a property that 'breaks even', will still make you a lot of money if you give it enough time. I would buy an unlimited number of cashflow neutral homes if I could get them each for a 0% down payment since given a long enough timespan each of those neutral homes will make me money. However 0% down is incredibly difficult to obtain, and financing for down payments is limited so you should use that money wisely and find a home that is better than just neutral.
Some people say that banking on appreciation or rent increases is speculating, which is true but only if you view it in the short term. Just like the case of the casino it is only speculation if you look at any particular bet, or any particular annual price increase of your home. If however you do not limit yourself by being short sighted, and look at the big picture over the course of multiple decades I will bet on appreciation all day long because I am confident on a positive inflation rate over the course of those same decades.