In both cases, one that isn't turning and has no current flowing.
Best way is to not run them when you don't need them.
Traction motor/regeneration systems are a different matter, there you try to optimize efficiency given that you need to accelerate and decelerate frequently, and many modern designs use the motor as the generator. Just not both at the same time like you seem to want!
In fact motors already work as generators while turning, this leads to "back EMF". After an unloaded motor spins up to full speed then the back EMF is nearly equal to the applied voltage (the difference being due to electrical and mechanical losses).
Tim.