Editor's Note: This is the fifth in a series of six features on the science of food, running daily from March 30 through April 6, 2009.

STATE COLLEGE, Pa.—Donald "Buster" Needham and his sons Artie and Don are moving their mushrooms out of Pennsylvania. Needham, 73, took over the business from his own father 50 years ago, but his West Grove operation—fueled with several hundred tons of steaming horse and chicken manure each week—has proved too stinky for city folk buying up homes in this township 40 miles (65 kilometers) west of Philadelphia.

In 2004 Needham announced plans to expand, but his neighbors shut him down, complaining of fetid odors and the potential for manure runoff to seep into groundwater and nearby streams. "The regulatory people, the township supervisor in the area, and neighbors—they wouldn't accept anything," Needham says.

Slide Show: Inside the Mushroom Science Lab

That October, the township blocked approval of Needham's expansion plans, denying his request for an agricultural security exemption from odor nuisance laws and claiming that he had not met its demands to install state-of-the-art odor-control equipment. Needham successfully appealed the decision in court but the board refused to let it go, taking the case to the Supreme Court of Pennsylvania, where it has been on hold for two years. In the meantime, Needham is mulling an offer from a developer who wants to turn his farm into a retirement community.

And Needham isn't the only farmer feeling the pinch. Mushroom expert Dan Royse of Pennsylvania State University in University Park says it's the same story all over the Keystone State, which is the nation's largest mushroom producer: Some 500 million pounds (225 million kilograms) of button mushrooms grown within its borders hit the market annually, and at $453 million, mushrooms are the state's largest cash crop. As much as residents rave about the yearly Mushroom Festival in historic Kennett Square each fall, few want a mountain of manure in their backyards. And while Republicans may have raised a fuss last month about federal funding of pig odor research in Iowa, farm odors are a national problem that are pitting agricultural economies against a deluge of suburbanites who thought they wanted a piece of the country lifestyle. That's why Penn State scientists are stepping in to try to make the beleaguered mushroom industry more environmentally friendly.

In early October, Royse brought me out to the university's own mushroom house. Kept at a constant 60 degrees Fahrenheit (15.5 degrees Celsius), the dark rooms had a slightly musty odor, but—lucky for me—the sulfuric smells that occur during the earlier composting phase had already faded. Seven wooden shelves were stacked atop one another and arranged in two long rows. Every 10 minutes a humidifier sent a jet of steam into the air, and water trickled down the cinder block walls. Royse stepped over a puddle and shined his flashlight on the pale button mushrooms, alienlike and devoid of all color, they were crammed together like eggs in a carton. The mushrooms popped up so quickly during two seven-day "flushes" that commercial pickers had to come through five times daily.

The world of fungi is indeed alien. It is an organism that bridges the chasm between plant and animal: They are rooted in the ground like a plant, but whereas plants breathe carbon dioxide (CO2) and use the sun's energy to convert the gas into sugars, fungi need to "eat" solid carbon and break it down with the oxygen they absorb—much like an animal. If you plant a cornstalk in the ground, the soil won't disappear around it, but that's exactly what happens to the compost here. The fuzzy filaments that permeate the mixture are what Royse calls "the pipes" that feed the mushrooms. By the time the crop is harvested—five pounds per square foot (about 24 kilograms per square meter) the dry weight of the compost below will have decreased by 20 percent.

The fragrant process that brings fungi to the dinner table begins when Needham's crew salvages straw bedding from horse tracks and stables, mixes in fresh hay and manure, and spreads it out in long rows for seven to 14 days to naturally pasteurize it. As bacteria living in the manure break down its nutrients, their metabolism raises the temperature to more than 120 degrees F (50 degrees C), leaving only the hardiest organisms alive. Mushroom farmers call this the pasteurization because it also kills off many unwanted fungi, which could steal nutrients from the buttons. The manure stench itself isn't so bad, but after a few days, oxygen levels in the pile decline, encouraging growth of anaerobic bacteria, which do not require oxygen and emit gases reeking of rotten eggs. The problem, Royse says, is that sulfur "has got a real low odor threshold so you can smell it from far away." In addition, water runoff from compost piles pollutes groundwater and open streams.

In 2002 Royse's colleague Paul Heinemann found that installing air jets beneath compost piles in bunkers could keep foul odors down by encouraging the growth of the aerobic (oxygen-dependent) bacteria. He measured airborne sulfurs around the sites and enlisted experts trained by the Monell Chemical Senses Center to rate odors between "barely detectable" and "strongest imaginable". In other studies, Heinemann put Gore-Tex breathable fabric over compost piles to reduce smells, and he even got mushrooms to grow on grain rather than compost.

But Royse realized there might be a way to cut those mountains of compost down to molehills, which would have the benefit of reducing costs, along with odor and pollution problems. After the second flush of mushrooms, the yield from a third flush is so low it's hardly worthwhile; even so, at this point the mushroom crop has only consumed 20 percent of mass of the compost material. The rest is dumped. "That's a shame,” Royse says, "If we could add that 20 percent back and get another crop, that would be a lot more efficient."

The challenge is to figure out what nutrients the mushrooms have actually sucked out of the compost that lead to the 20 percent reduction in its mass. Then, Royse will have to find a practical method to prevent molds and other mushroom pathogens from infiltrating the soggy substrate during a second crop with two additional flushes.

In another room, Royse has divided up experimental compost mixtures into nine different treatments on which he will test the effect of adding supplements including isoleucine, which he reported in 2008 as the most important amino acid for stimulating mushroom yield of the second crop. Other amino acids like valine are also important, but his research has shown that isoleucine alone can increase second crop yield by 68.7 percent.

A couple of mushrooms have poked through the soil, and I ask Royse if that's the second crop. "We're trying to triple-crop," he says, "We're getting greedy."

His secret weapon is a piece of landscape cloth, which he places  between the compost and the top layer of peat moss that growers call the casing. Once one crop is complete, Royse can toss out the peat moss, supplement the compost, and add a new layer of peat already infiltrated with fungus. The filaments of genetically similar fungi can reconnect through holes in the cloth. "They hook those pipes up and nutrients start to flow," he says. Royse and his team are also experimenting with another fungus, Scytalidium thermophilum, which helps mushrooms grow on unpasteurized compost and keeps competing organisms from colonizing the manure.

The problems don't end once the mushrooms have been harvested one, two or even three times. Disposing of that spent compost—which begins to reek again after harvest—is costly as well as an environmental liability. Recently, however, it has proved to be a remarkable natural agent against an insidious pest, says Penn's Donald Davis. The artillery fungus lives in bark mulch and has evolved to shoot its tiny spores at bright surfaces, like the sides of cars and homes. It may sound like nothing, but the spores are practically impossible to remove and after a series of lawsuits, homeowner's insurance companies now exclude the vermin from their policies. Davis found that adding 40 percent of the spent mushroom compost to mulch mixtures eliminates the pest.

"A few years ago they couldn't get rid of [mushroom compost]," Davis says. "Now they can give it away. We hope the next step is they can market it." One company, Laurel Valley Soils, already has a contract to provide mushroom soil to the 9/11 memorial in New York City to prevent structures from getting dotted with stains.

The question now is whether these innovations save Needham's mushroom operation. "It would be a great thing," he says of Royse's double-cropping. "It would save a lot of material...and make us more efficient." The cost of straw went up by 30 percent last year, Needham reckons, which represents the biggest increase in the cost of mushroom production.

All this talk about mushrooms gets him excited, but Needham finally comes clean: West Grove recently brought in a real estate developer to convince him and his sons, ages 39 and 45, to abandon the fight. "They gave us a price that would have a tendency to make us move," he says. He would not reveal the winning offer, but the supreme court case has been delayed five times, as the developer has struggled to obtain investors for his proposed retirement community, which includes, fittingly, a new sewer system. "As soon as things begin to turn," Needham adds, "this farm will be sold."