In reply to MonkeyPuzzle:
Assuming there is no new mortgage for the seller, then final sale proceeds + some of the deposit goes to their mortgage company and they get the rest.
£400k house, £40k deposit, £380k existing mortgage.
You give £40k to their solicitors (it doesn't go to the seller). On completion the solicitors arrange the money transfers so £380k goes to the bank and £20k to the seller.
Did you think £20k went straight to the seller and the other £20k was kept back to return to the buyer?