who defines "farmer"? traditionally, a farmer raised food for their family and sold any extras to buy whatever else they needed. it is my understanding that that applies to a lot of people who only have a few hens or whatever. i feel these laws (in most places, i haven't read up on all of them) are fully usable for protecting the smallest of small time farmers. it is our right to produce our own food.
of course, health codes and sanitation do trump RTF, though it is possible to have small animals like poultry in a fairly small area without any sanitation issues. the people who pile manure of whatever form can (and, at times, should) get in trouble for that kind of thing. similarly, having a cow on half an acre is almost impossible to do without sanitation issues. that would also be unfair to the animal.