Most people don't take 30 years to pay off their mortgage, which is why mortgage rates tend to move with the 10 year treasury rather than say, the 30 year rate. The investors generally assume the average prepayment results in them being paid off in about 10 years, and since they're the ones the mortgage lender is offloading to, it's what your rate is determined by.
You buy a house, service the mortgage while you're there, then sell it (using the proceeds to pay off the mortgage), and if you've not made a bad investment, you come out with more money than you went in with, which presumably, you put toward a down payment on your next home. If you're downsizing, it may mean you're buying your next home outright, or with very little of the capital borrowed.
Unless, of course, your property value declines. Watch out for bubbles, and get sensible insurance to mitigate the risks.