(1) A farmer who prevails in any action, claim, or counterclaim alleging that agricultural activity on a farm constitutes a nuisance may recover the full costs and expenses determined by a court to have been reasonably incurred by the farmer as a result of the action, claim, or counterclaim.
(2) A farmer who prevails in any action, claim, or counterclaim (a) based on an allegation that agricultural activity on a farm is in violation of specified laws, rules, or ordinances, (b) where such activity is not found to be in violation of the specified laws, rules, or ordinances, and (c) actual damages are realized by the farm as a result of the action, claim, or counterclaim, may recover the full costs and expenses determined by a court to have been reasonably incurred by the farmer as a result of the action, claim, or counterclaim.
(3) The costs and expenses that may be recovered according to subsection (1) or (2) of this section include actual damages and reasonable attorneys' fees and costs. For the purposes of this subsection, "actual damages" include lost revenue and the replacement value of crops or livestock damaged or unable to be harvested or sold as a result of the action, claim, or counterclaim.
(4) In addition to any sums recovered according to subsection (1) or (2) of this section, a farmer may recover exemplary damages if a court finds that the action, claim, or counterclaim was initiated maliciously and without probable cause.
(5) A farmer may not recover the costs and expenses authorized in this section from a state or local agency that investigates or pursues an enforcement action pursuant to an allegation as specified in subsection (2) of this section.