Any half-competent realtor will tell you that if you aren't going to stay in a house for 3+ years you will probably lose money on closing costs/fees.
Contrast this with my house, I stayed in it for ~6 years and the house went up ~$100K in value. During that time I put ~$50k into it (AC, Insulation, Pest, replaced some pipes).
But most importantly, it was mine. I did have to manage my own maintenance but I've lived through almost a decade of renting at differently places and the "included" maintenance is dog shit. At one point I had water in my kitchen floor such that as you'd walk water would come up through the seems in the vinyl for well over a month... on the 16th floor. I also had long streches where the elevators weren't working and every year they increased rent $50-$100/mo. Right as I was moving out they wanted to add a $25/mo pet fee and the removed our cable modems and made everyone use wifi-only (limit 10 devices). Yes, some of those could be avoid renting a house not an apartment but I've lived that life as well and it ain't all roses either.
TANSTAAFL. Maybe renting and owning come out about even for most people in most situations, but a lot of the "perks" of renting really sucked IMHO and I greatly preferred being in control of my own destiny, never having to ask permission, not feeling like a second-class citizen, not having the owners stop by or want to show off my unit to a prospective customer.
I have zero desire to go back to renting until it's time for nursing home/assisted living-type place for me.