This is only true if you assume the same housing at the same cost/mo (including everything). And assume timelines. Usually this isn't the case, so there are definitely scenarios where you are better off renting.
I guess I don't follow - if you rent, for any period of time (sure, I'm slightly assuming a longer period of time - say, >1 year), you will give the landlord rent money over that duration, and walk away with ~nothing at the end. I'm not saying it's impossible to lose LESS with buying unwisely / unluckily, of course.
You have to factor in everything. It's not just rent payment vs. mortgage payment, it's everything you spend on housing (taxes, repairs, etc.) in two scenarios.
In any situation where the rental scenario results in extra cash flow that you then invest, you can end up ahead in total, sometimes significantly so. It's all complicated by the fact that you are rarely comparing rent vs. buy on the actual same property.
Remember also in the "buy" scenario you have to include closing costs etc. which can affect your timeline. Your 1yr is unrealistic, you'll eat 5-10% of sale price on just that, typically, which may be way more than rent.