Lots of things, it turns out.
A mortgage is financial leverage. You only have x dollars but you spend x * n dollars and repay x * n plus interest later. This works out for you if the value of the money you are spending now is more than the value (value is relative) of the money that you repay over the next 30 years. It does not go well of the opposite is true.
The mortgage can be good because it locks you into a fixed payment per month. Rents fluctuate, if rent goes up, you pay more money. Mortgage payment does not go up (other than taxes which can). The downside is if rent goes down, you don’t get to take advantage of it.
So, it’s two very different sorts of bet on the housing market. It’s like a long term bond vs a short term bond, somewhat.
Note well that houses do depreciate, but depending on the area, the land will not. The depreciation in your house takes the form of maintenance in some cases, or a lower sale value than a newly renovated home.
In a major metro, the majority of the value of a house is land value, not building value.
Cars depreciate extremely rapidly, it would be a problem if we had to rebuild houses every 15 years. (Although Japan’s housing market is actually kind of like that and is very interesting to read about, you should look into the issues there if you haven’t already).