Lose electrons - electrons want to fill their outer valence shell, so sometimes instead of gaining it is easier to lose some and have a filled outer shell
Basically, all phosphates except Sodium phosphates, Potassium phosphates and Ammonium phosphates are insoluble in water. That, of course, includes Magnesium phosphate.