You just get 1 heart back whenever you enter the shop. When you buy a weapon with a higher maximum health stat you'll get the difference of that to your old weapon added to your health as well. That could make it look more complicated than it actually is.