It's just one factor in the calculation.
One thing to consider however is that you get the Interest, PLUS property taxes, PLUS any other itemized deductions (sales tax, etc) For some people this might open up several thousand worth of other itemizations that they could not use before, because they were below the standard deduction. (since if you can't get your itemized deductions up above your standard, there's no sense itemizing)
So you need to consider, how much you would pay to rent, vs how much you'd pay in PITI (Principle, Interest, Taxes and Insurance), less the additional money you'd save in taxes, less any equity you build, PLUS market changes to the value of the house, PLUS largely locking in the majority of the payment (mortgage and interest) compared to potentially rising rental costs. LESS the obligation to take care of the place, being 'tied down' when it comes to relocating, taking a year off to travel, or what-have-you.
For some folks, it's simpler and easier to rent. For others buying makes sense, and given the long term overall trend in housing prices in most markets, there can be a substantial return on the value of the property going up over time. (otoh, you have to be able to sit out 'corrections' and events such as the last few years).
for myself, since I bought my current house around 12 years go, I'm still pretty far up in value from when I bought it, AND while rents have gone up substantially, my payments, are close to what they were 12 years ago (lower rates + refiance balanced out increases in taxes and insurance)