How this rent vs buy comparison works
Both paths start with the same money. The renter invests what the buyer would have spent on the down payment and closing costs. Each month, whichever option is cheaper invests the difference at your chosen return. The buyer's net worth = home value − selling costs − remaining mortgage + their investments. The renter's net worth = their investment portfolio.
Owning costs include mortgage P&I, property tax and maintenance (both scaled to the home's current value), insurance and HOA. The break-even year is the first year buying comes out ahead.
What it leaves out
Income taxes (mortgage interest deduction, capital-gains exclusions, tax on investment returns), PMI, and rent deposits — so treat it as a guide.