The buy-vs-rent decision depends on down payment, mortgage rate, rent, and how long you stay.
In expensive cities, renting often wins for stays under 5 years. Buying wins long-term.
Generally if staying 5+ years, mortgage rate < 8%, and price-to-rent ratio < 20.