Canada is similar - usually you can prepay up to 15%/year, but any more than that and you need to pay a penalty (which seems to be calculated based on the interest they would lose). Also the yearly prepay amount is use it or lose it.
And yes, the prepay penalty is generally based on the interest they would lose or a few month's interest, whichever is better for the bank at the time of payment.
But also note that if you paid the extra for a 10-year, Canadian federal law says you can prepay 100% at any time after 5 years with no penalty (or virtually no penalty?). Which is part of why longer-term mortgages are markedly more expensive.
https://www.loan.com/home-loans/how-non-recourse-loan-laws-v...