To do this, you must be far enough into the Mages Guild quests so you can make your own spells. Go there and make a Fortify Health, Fatigue or Magika. You can make it target or self, but make sure it is only for one second. Then, repeatedly use it.
Press R1 to heal yourself whenever you have Magicka. This heals you and increases your restoration skill.
Go to the Arcane University or Frostcraig Spire and go to a Spellmaking altar. Create a spell that does "Restore Magicka on self." No matter what you put for the magnitude or time, unless you include another effect to go with it, you will always get more Magicka back than what you put in. For example, if you restore Magicka 100 points for 1 second on self, it will cost 90 Magicka, so you get a ten point profit. If you restore Magicka 100 points for 2 seconds on self, it will cost 181 Magicka, so you get 19 points profit. Only if you use the Construction Set and create a magnitude of more than what is possible with the Spellmaking altar will you end up spending more Magicka than you get back.