I do have a problem with the practice of caging chickens, but I buy them anyway.
Why is this?
The answer is simple; Free range/barn eggs are a scam. The ONLY difference between free range and cage is the cage. The chickens don't have any more space to move around in, they pack them in the barns just as tight as in the cages.
Choose your poison, but don't kid yourself into thinking you're doing the 'right' thing.
The only way to do that is to get eggs from a local farm, where you can see how the chickens are kept. (which I do occasionally, when they have eggs available).