A generator converts mechanical energy into electrical energy, while a motor does the opposite - it converts electrical energy into mechanical energy. Both devices work because of electromagnetic induction, which is when a voltage is induced by a changing magnetic field.
They are the same. If this is all happening on Earth, then the ball's acceleration is 9.8 m/s^2 in either case. That's the acceleration of gravity around here.