The balls are not perfectly elastic, but the main reason is probably air.
Step-by-step explanation:
When 2 adjacent balls have any distance between them, there is air in the space. When the moving neighbor comes at a stationary ball the moving ball has to push the air out of the way.
I hope this helps