Nature uses cellular-scale nanotechnology to build millions of microscopic linear motors. We can build linear electric motors by essentially unrolling the stator, but they're on a much larger scale.
We get better results with servomotors, either installed with some gear reduction at a pivot joint, or hooked to a ballscrew linear actuator.
http://www.cam.ac.uk/research/news/functioning-mechanical-ge...
Motor torque is limited by the current you can run through copper wire, times the magnetic field you can generate with permanent magnets. The best motors are only about 2 Nm / kg (continuous torque / motor weight). A knee joint requires torque around (weight of robot/2 * length of tibia) in order to squat, say 100 nM for a human-sized robot. Direct-drive motors would weigh 50 kg each! So in practice, you use a 20:1 gearbox and 2.5 kg motors.
Superconductors could totally change that some day.