Mortgages are subject to a 1.5% tax in Catalunya (differs by autonomous region). This tax applies to the maximum amount that the bank can claim from you (called the “responsibility”). Since banks are greedy, they give themselves a big cushion that they can use to claim legal costs, etc if you default on your mortgage.
In many cases the amounts they claim are outrageous. For example, for 400.000 mortgage, they ask for a “responsibility” of 700.000, meaning that they could legally recover up to 300.000 extra in legal costs directly if the property is foreclosed on. If you challenge them on this, their first line of defense is that it’s a tax and they are legally required to pay it. Then you call them on their bullshit, since you are paying 4.500 euros extra in taxes for the privilege of them being able to recover an extra 300.000 from you on top of the money that they are owed.
If they claim they are unable to change the amount of responsibility, then just go somewhere else. Different banks have different maximums, and usually it is around 140-160% but can be as high as 200%.
One way to avoid this tax entirely is to subrogate any existing mortgage on the property. This transfers the responsibility of paying the mortgage to you, and can include some minor modifications (such as interest rate), and the only required costs are notary and registration costs (everything else is negotiable). It’s a win-win, since the seller then doesn’t need to pay any early termination fees. Even if the mortgage is officially not subrogatable, in many cases the bank that wrote the mortgage will do it anyway if you make it worth their while.