Electromagnetic crane
toasters often use a 12V electromagnet it's on an E-core form (like a transformer)  about 3cm on the longest dimension. that sounds about the right scale and strength for a lego project.

on the other hand A search on digikey for "electromagnet" turned this up under miscellaneous, they have no stock, but seeed will sell direct.
http://www.seeedstudio.com/depot/Grove-Electromagnet-p-1820.html
(note 5V not 12V)

another option is to modify a choke (which is constructed like a transformer but has only one winding), "Triad Magnetics C24-X" looks about right for your task. available though http://mouser.com/

12V into 50ohms is 240mA - perfect.