Electromagnets (solenoid coils) use a lot of current which is a negative to shaft horsepower on a self contained plant.
This may have been the case at one time, but it is not so anymore
Solenoids can be pulsed at high frequency such that the power use is just a small fraction of what would otherwise be used, it is also possible capture the collapsing field of a solenoid with a secondary winding so that much of the power can be retained in a similar way to a transformer.
There are people manufacturing IC engines running at 10,000 rpm with solenoids operated the valves. Toyota has invested millions into the technology such that they can completely control induction and exhaust to the point of stopping the pumping action of some cylinders completely when only limited power is needed.
Toyota and other car manufacturers are working toward having one cylinder of the IC engine operating as a steam engine using some undisclosed liquid with a very low boiling point, the liquid is heated by the engine coolant and exhaust gasses, the system is said to make the radiator obsolete. Toyota expect to have the engines in production within 5 years.
Google "Camless Engines" and you will find a stack of information on solenoid actuated IC engine valves.
Lionel