chickens sometimes do that. Many animals eat feces to recycle the nutrients left behind, and also to repopulate their guts with beneficial bacteria. Our medical profession is now wising up and using fecal transplants to cure difficult cases of C-Diff! But, I wonder if they are lacking some vital nutrients in their feed. Just b/c they are getting a balanced feed, it does not mean that all of their nutrient needs are being met. You might try putting them on a higher protein formulation, give them access to a compost pile, start doing deep litter in their coop and run, give them some animal protein. Try Poultry Nutri-Drench.
Pepper spray won't stop them. They don't have taste receptors for that.