Paul Dagostin's barn, which houses nearly 5,000 hogs in Salem Township, Pennsylvania, is in the crosshairs of some nearby residents.
"They want to shut me down because of the smell," said the 45-year-old, third-generation farmer. Dagostin, who is married and has two small daughters, said he built the barn last year after taking out a business loan of a million dollars—and after meeting all township and state requirements.
"Now they are threatening me with a $20 million lawsuit. I don't think they can shut me down, but I'll have to hire lawyers to fight this," said Dagostin, who raises hogs supplied by Country View Family Farms.
What some in the township of 4,000 people want—and others in several farmland towns across the country want as well—is to change zoning and other laws in order to limit neighborhood farms from becoming more industrialized. The focus is stopping the pollution, such as bad odors or contaminated water from runoff, that may come with larger farms.
"It's a big issue especially in parts of the country like the Southeast where they produce a lot of hogs," said John O'Brien, an agribusiness lawyer at Snell & Wilmer and a wheat and corn farmer.
"If you're in a state like North Carolina or California with a humid climate, the odors can carry up to 15 or 20 miles," said O'Brien, whose firm has helped secure financing for farm expansions. "We're likely to see more of this as urban sprawl creeps closer to farms."
The fight is dividing the southwestern Pennsylvania community, said Joshua Kishbaugh, chairman of the Salem Township Board of Supervisors.
"We are pro-farm, but when you take a family farm and make it bigger, you affect everyone," said Kishbaugh. "Sometimes the smell from the hog farm almost makes you throw up."
What residents can or can't do to shut down or stop farm industrialization varies from state to state. Most agriculture states have right-to-farm laws, which in theory shield agricultural operations from legal actions such as nuisance lawsuits over issues like bad odor.
Right-to-farm laws can also prevent local governments from passing zoning laws that are more strict than those already in place at the state level.
However, farms like Dagostin's are classified by the Environmental Protection Agency as consolidated animal farm operations (CAFOs). That's because they feed more than 2,500 animals and house them for more than 45 days during a growing season.
Feed is brought to the animals rather than the animals grazing or otherwise seeking feed in pastures and fields. Animal manure is collected in lagoons or underground pits which are diluted with water and eventually emptied like septic tanks.
While mostly protected under right-to-farm laws, CAFOs have specific federal and state regulations. They are required to have a nutrient management and odor management plan and face inspections from state officials—rules Dagostin said he follows to the letter.
"Everything I do is legal and highly regulated," said Dagostin, whose farmland has been in the family for decades. "We put in additives to cut down on the smell, and we inject the manure in the ground."
CAFOs, which produce the majority of U.S. livestock, have come under a fair amount of criticism over the years. Critics say they force livestock into confined spaces while producing manure that gets stored in pits or vats that could leak into local water supplies.
Others point out, however, that when properly managed, located and monitored, CAFOs can provide a cheaper source of meat, milk and eggs, due to efficient feeding and housing of animals.
There could be one way to end the odor battle, said John Kempf, founder and CEO of Advancing Eco Agriculture, an agricultural and horticultural consulting and manufacturing company. But it would likely eliminate CAFOs.
"It's too simple to say smaller is best for farming, but you can have smaller farms, have animals run free on land and have the manure go back into the soil instead of having to collect it," said Kempf, who is a farmer in Ohio.
He argued that his kind of model would cut down on the bad odors and threat of water contamination, while still making profits for farmers by having lower investments and more product per acre of land.
But Snell & Wilmer's O'Brien said the hog may be out of the barn when it comes to CAFO farming.
"There's still a move to the bigger farms with livestock," he said. "If you are on one end of the smell, it's intolerable. But others smell a way to make a living."
Those threatening Dagostin with lawsuits are fighting against having another pig feeding operation in Salem Township. The fight has even broken family ties.
The farmer who's proposing a 4,800 pig farm is being actively opposed by his two nieces. Besides bad odors and possible water pollution, residents claim Dagostin's farm and the proposed one have lowered home values.
To help tighten up rules governing the expansion of certain farm activities, Salem Township has set a May 14 vote to change some of its zoning laws. Township supervisor Kishbaugh said the changes, if approved, would create more physical separation between farms and other properties—while calling for better farm water pollution testing.
But Dagostin said the problem goes beyond the nose test. "I can understand them being upset, but we would have to shut down everything that smells to make people happy," he argued. "This is about being a farmer."
—By CNBC's Mark Koba.