In the U.S., as long as a farmer is adhering to the inherently cruel husbandry standards, there is no punishment for the systematic mistreatment of animals that defines factory farming. Animal suffering is seen as being “necessary”, and therefore legally justifiable.
In cases when someone has been found to cause animals “unnecessary” suffering, meaning, the deliberate injuring of animals or neglecting them to the point of injury, state laws can come into effect, with punishments that vary by state. However many of these laws exempt farmed animals from consideration.