Sometimes. Buying a home is typically cheaper than renting if you plan to stay in it for a significant time so that when you sell, you do not lose money on your initial investment. On the other hand, if you only plan to stay in a home for a couple of years, it may be best to rent since you have fewer upfront costs and do not take out unnecessary debts.
Similarly, if you are looking to buy a “fixer-upper,” you may need to invest a significant amount of money on top of the initial investment to get to a livable state.