What they are fed absolutely makes a difference. However, a lot of folks feed the same bagged laying ration that the big battery farms feed.
A chicken given the change to scrounge around will have different tasting eggs than one that is kept cooped up. Lots of chicken are kept in coops, with just a little more room than a battery hen. Those eggs will taste the same.
The real trick is to graze some good pasture with cattle or hogs, cover crops in particular, then let the chickens follow behind. They will pick through the manure, eat bugs, plants, hell...rocks,....that is a tasty egg!
But you are probably right, happy chicken make better eggs...no matter where they are.