You make a common mistake about leveraged bets here in your claim about "gaining nothing".
Suppose house prices evolve from price p0 to price p. The market gains (or loses) p/p0 in that period. If you get a mortgage, you're borrowing money to buy at p0; at any point in time with a price p and total repaid r your total value is given by (deposit + r + p) - p0. You're in negative equity if (deposit + r + p) < p0. You're in the money if p > p0, but note that this isn't multiplying your investment by the market gain. Instead, it's exposing you to the absolute change in price. So suppose (deposit + r) = 40k ; p0 = 145k ; p = 190k. You're in the money for 40k + 190k - 145k = 85k, having invested 40k (roi=2.1). p1/p0 = 1.3 (<2.1), with your leverage (mortgage) having bought you more exposure to house prices. You can then liquify and re-lever back into the housing market, with a larger loan due to you larger deposit (and likely increased income). Historically this has worked very well for people as p has tended to be larger than p0. It does not work well if you end up in negative equity.
Suppose house prices evolve from price p0 to price p. The market gains (or loses) p/p0 in that period. If you get a mortgage, you're borrowing money to buy at p0; at any point in time with a price p and total repaid r your total value is given by (deposit + r + p) - p0. You're in negative equity if (deposit + r + p) < p0. You're in the money if p > p0, but note that this isn't multiplying your investment by the market gain. Instead, it's exposing you to the absolute change in price. So suppose (deposit + r) = 40k ; p0 = 145k ; p = 190k. You're in the money for 40k + 190k - 145k = 85k, having invested 40k (roi=2.1). p1/p0 = 1.3 (<2.1), with your leverage (mortgage) having bought you more exposure to house prices. You can then liquify and re-lever back into the housing market, with a larger loan due to you larger deposit (and likely increased income). Historically this has worked very well for people as p has tended to be larger than p0. It does not work well if you end up in negative equity.