No, actually it doesn't. Using your home loan payment example:
Let's take $1M home loan (I'm in CA, lol), with a 3% interest rate. You'll need to pay $4216.04/month to pay it off in 30 years.To pay off the house in 20 years instead of 30 years, you have to pay an additional $1329.94/month to save a total of $186,740.29 in interest over those 20 years.
If, instead you put $1329.94/month into an S&P500, and even conservatively say you get a 5% annualized return, you'll have invested $320,515.54 and received $224,907.59 in returns. So, by doing nothing other than not paying off the loan earlier and instead investing, you'll have an extra $38k by doing basically nothing.
But wait, after the 20 years, you have no debt and can put that to work in the market. Great observation! Let's look at it.
So, after those 20 years of extra payments, we're starting with nothing, but can now put in $4216.04/month for the next 10 years. After those 10 years, you would have invested $510,140.84 and received $150,179.35 in returns. Not looking good, we already had more returns from not paying any extra monthy. So, you end up with a fully paid off house and $660,320.19 after those 30 years.
If we continue putting in that $1329.94/month in the don't pay early scenario, after 30 years we have paid off the house, and our investment total was $480,108.34 and $614,458.60 in returns. You end up with a fully paid off house and $1,094,566.94. So, by not paying off the house early, you'll have an additional $434k to your name.
This is assuming a ridiculously low 5% annualized return and not factoring in writing off your mortgage on your taxes. But wtf do I know.