Some mortgages come with a provision that penalizes you for paying off the loan balance faster. Such penalties can amount to as much as several percentage points of the amount of the mortgage balance that is paid off early.
When you pay off a mortgage early because you sold the property or because you want to refinance the loan to take advantage of lower interest rates, some lenders won't enforce their loan's prepayment penalties as long as they get to make the new mortgage. Even so, your hands are tied financially unless you go through the same lender.
Many states place limits on the duration and amount of prepayment penalty that lenders may charge for mortgages made on owner-occupied residential property. The only way to know whether a loan has a prepayment penalty is to ask and to carefully review the federal truth-in-lending disclosure and the promissory note the mortgage lender provides you. Many so-called 'no points' loans have prepayment penalties.