Some loans contain provisions requiring you to pay a penalty if you pay the loan off earlier than agreed or if you make larger principal reductions than the lender planned.
If there is a penalty, it is generally only during the first few years of the loan. Sometimes it is a percentage of the loan balance at that time, and other times the penalty is six to twelve months of interest.
The reasoning is that a lender counts on receiving an income stream for a certain period of time. If it receives its principal early, then it must loan it to someone else as quickly as possible.
That might not happen immediately, and it will almost always require some marketing and administrative expenses.