I bought a cheap impact driver and I noticed that the bit is moving inside the chuck, like back and forth. Is this normal, like part of the hammer mechanism, or should the bit stay fixed?
If this is an impact driver (see below)
then it uses a 1/4" hex chuck. Most use a simple ball-detent system to lock bits in place, which allows for some slip, especially forward and backward.
If you got an impact wrench (see below)
then it would be a problem, but if you were getting an impact wrench, you likely wouldn't be asking this question.