A method for calculating prepayment penalty, yield maintenance considers the difference between prevailing interest rates and the contractual interest rate of the loan such that the borrower does not benefit from changes in interest rates and the lender is not disadvantaged by changing interest rates.
Yield Maintenance is generally calculated by finding the present value of the remaining cash flows due to the lender, discounted back at an agreed upon discount rate using an agreed upon benchmark rate (e.g. government bond yield), less the outstanding loan balance at the time of prepayment.