That's true in general. And if you assume a perfectly efficient market, yes, renting would never be cheaper than buying. On the other hand, if markets were perfectly efficient, no company would ever be able to make a profit at all.
One market distortion is that in certain times, people will actually pay a premium for renting. People aren't perfectly rational actors. Or moreover, they prioritize things beyond just simple cost. Even if buying is more expensive that renting, all costs considered, often people will pay more just for the stability and certainty that comes with home ownership.
The housing market is also distorted by all the present owners with locked-in 30-year mortgages. This has suppressed the supply of existing homes on the market. Rental companies don't get access to federally-subsidized 30 year mortgages, so they are less subject to this interest rate lock-in.
I pointed out a few things, but these are a few of many. The key thing to realize is that housing is highly illiquid, and its production, ownership, and sale is heavily regulated, taxed, and subsidized. It's a heavily regulated market. This means that the market will not always follow basic econ 101 behavior. Yes, in theory, rentals will include all costs. But that is rarely the case.
In fact, in a perfectly efficient market, it's likely that neither buying nor renting would be beneficial. If everyone acted perfectly rationally all the time, the cost of renting would exactly equal the cost of buying. And in that world, buying would never be worth it, simply because it wouldn't be worth the extra hassle to safe not a single penny.