Hi and welcome to the forum. It is possible to take over a mortgage in Spain, and you do avoid some of the costs associated with setting up a new mortgage, but the main problem for those whose homes are at risk of being repossessed is that many of them are in massive negative equity. If you took over a mortgage in these circumstances then you would be paying way over the current market price.
If an owner has a mortgage which is below the current market value of their propery, and is willing to sell at a low price, then there are lots of buyers now, all looking for bargains. There are many of these bargains around at the moment and mortgages are available, so it is worth exploring all the options.