I wonder why it isn't illegal to keep them that way?
It's complicated(really, it is), but it's similar to the reason why chickens can be housed in the same manner.
*NB; Did you know?
"Free Range" chickens aren't actually *raised* in fields with room to run around, but rather are chickens which are provided "some" time("some" is defined as a portion of any given day, I think) outside of their cages free to run around etc. This could be 8 hours a day, or 30 minutes a day.