In the same way that an electric motor and a generator are the same thing.
In an EV they literally are.