Of course, as long as they can afford it!
This is called "subrogacion" in Spain. BUT, the person taking over the mortgage and the property has to go through the usual checks with the bank to satisfy them that they can afford to pay the mortgage.
Subrogacion can be popular because you don't have the costs associated with opening a new mortgage, so there is a saving to be had, but from a buyer's point of view I don't think it's actually any easier in terms of getting the actual mortgage.