Also colubrid hatchlings are routinely kept in very small enclosures. Not everyone working at a petstore will be an expert on reptiles, maybe that person was hired because of their fish, dog, cat or small animal knowledge.
It was kept in that small cage within the tank because this Kingsnake will eat other snakes. And given that the rack/cage systems at petsmarts don't look too secure I'd say it was a good idea.
I can't speak to how long it was since the cages were cleaned. If the snake had spilled its water bowl it probably did look pretty gross in the cage. Many stores wait until just before closing time to clean the reptile cages because it is when there is the least amount of customer traffic and as such fewer interruptions.
Just offering up a bit of a different perspective on what may have been going on. The snake doesn't look underweight or dehydrated.