The IRS does make some interesting exceptions and deductions for farmers. But don't think you can scam the IRS by claiming your backyard vegetable garden as a farm. The IRS is well aware of the difference between "hobby farming" and "we have to take out a second mortgage on the place because the crops failed" farming.
It's important to know the difference, because if you're a for-real farmer, you can deduct expenses even if your business has been operating at a loss for multiple years. Hobby farmers don't get the same breaks; they're not allowed to buy a lot of cool farming equipment, make no money, and then claim a deduction for it. Basically, if you're operating at a profit for three years out of five, you're a business.
Even if you're operating at a loss for several years, the IRS will make exceptions if you meet certain criteria to qualify as a farmer. They set out nine conditions; one of the easiest ones is that the time and income you spend farming indicate an intent to profit. Another is that you or your associates have enough expertise to carry out a profitable farming enterprise [source: IRS]. Meet all nine conditions, and you can be considered a farmer, albeit one with some history of loss.