This doesn't make sense for Americans because they use a single currency for everything, but in Europe, there is a benefit to having a revenue stream in a desirable currency which is appreciating relative to the Euro.
To the buyer, the loan looks like 0% because the buyer pays back the loan in Franks or whatever. The bank, meanwhile, gave out a loan of X Euros, and is receiving payments in a currency whose aggregate value is X+Y Euros. Their profit is Y. There's also the opportunity to make even more money selling options backed by these payments.
This is a completely valid means of making money, but it carries substantially higher risk than single currency lending. Which is probably the reason most banks don't want to carry too many of these on their balance sheets.
You can hedge against the performance of CHF by keeping proportional revenue streams of EUR.
If I purchase property in Switzerland with a Euro denominated loan, I have to convert my payments from CHF to EUR. If I'm depositing into a CHF denominated bank account that is owned by the bank I'm borrowing from and they charge me currency exchange fee, ok, but if I'm savvy enough to go with a foreign currency denominated mortgage, I'm also savvy enough to find a cheaper way to convert CHF to EUR. Otherwise I have to take on the onus of arranging the currency exchange myself, in which case the bank I'm borrowing from doesn't have a chance to benefit from the exchange fee.
If I'm a European bank and I want to engage in currency speculation, like the other people said below, there's no reason for me to have to go through the administrative hassle of making the loan in the first place.
* https://ca.investing.com/rates-bonds/netherlands-government-...
Commercial bonds may not be too far off, so the spread may be enough for them to make a profit.
Bonds are created and then sold to share holders and you may even have a bond with your own mortgage in it.
Depending on the class of bond, you get paid more or less (this is the CDO)
The profits are from the bonds on the loan in the stock market.