The "Free Infinite Energy" Thing would work unless those are magic portals. The energy required to move the magnet back up into the other portal would AT LEAST be the same as the energy you would get out of it, if not less...