Some can, though they won’t do it whilst parked. Hybrid cars, in particular, are very good at this. The Toyota Prius, one of the market leaders, will, for example, seek to capture energy generated by the braking system and save it in the vehicle batteries for later use. All EVs need to be plugged in, however, to charge the battery when the vehicle is not moving.