My understanding of a motor is that when a supplied current is fed through the coils, it rotates due to the motor effect. However, as the coil rotates it also experiences a change in magnetic flux resulting to an induced emf, seen in a generator. This emf is in the opposite direction to the supplied emf explained through Lenz's Law.
My confusion is that if a generator rotates at the same speed as a motor, shouldn't the energy output of the generator be equal to the energy input of the motor for the same rotational speed? This is the law of conservation of energy. And if what I said above is true, then shouldn't a motor experiencing back emf have its current canceled out by the back emf?
I know this sounds wrong but I can't seem to understand why. Please help me by removing my ignorance.