And generally that investment is called the stock market. Is there long-term risk involved? I suppose so if the entire US crashes, but your house probably isn't going to be worth much anyway at that point anyway.Only if you have an investment that you know can beat the mortgage rate. For sure, no quesitons asked.
Pay off mortgage the day after you buy the house... losses = the price of the house
Pay it off after 30 years, losses = double to triple the price of the house
If you have an investment that you will put the payoff money into that regularly gets higher than the mortgage rate is the only time it makes sense.