It's more a supply / demand issue than anything to do with mortgages. When an essential good's (housing) demand outstrips supply, all surplus goes to $0 to reach the clearing price for that supply.
Ex: In SF there were a lot of good big tech jobs paying $200k-$1m / yr. A vast majority of those wage increases accrued into the hands of landlords. Mortgages allow buyers to borrow against projected future earnings, allowing each buyer an affordable price compared to one who doesn't mortgage, but when everyone does it the benefits get nullified.