Imagine a market in which you have no control over how your product is displayed, in which the regulation is stifling, and in which you are subject to absurd price constraints. Sound like a nightmare? The market in this case is the school cafeteria. And yet, despite (or, rather, because of) these headaches, the lunchroom lately has been a hub of entrepreneurial activity.

The American school lunch market dates back to 1946, when Congress began subsidizing lunches for students who could not afford them. Today the market is undergoing a health-food revolution, driven by concerns about rising levels of childhood obesity and ever-rising demand for organic and locally grown foods.

A federal law that went into effect last year mandates that all school districts create "wellness policies" or lose government funding. Meanwhile, the USDA is planning a $4.5 billion subsidy for fresh fruits and vegetables for schools. Not to be outdone, states and cities have set limits on fat and sugar content and, in some cases, banned entire classes of food.

The changes--which include recent bans on candy and marshmallows (Portland, Oregon), soda (Connecticut), and vending machines in elementary schools (Arkansas)--have made life difficult for incumbents in this $8 billion-a-year industry. "It's tougher on the big players," says Erik Peterson, a spokesman for the School Nutrition Association, which represents nutritionists and cafeteria staff. "A small company that focuses on one market can put out a product faster."

That scenario played out in New York City last year when the school system announced that it wanted only nonfat yogurt on the menu. One of the city's yogurt suppliers, the French conglomerate Group Danone, decided to pass rather than deal with the regulation. Upstate Niagara, a Buffalo dairy cooperative, scooped up the $1.6 million contract. It was all part of the company's expansion plan: In five years, Upstate Niagara, which had done no school sales previously, has established school business in 49 states, with more growth in sight. "The item is typically on the menu once per month," says Mark Serling, who runs the co-op's food services division. "It can definitely grow more."

The yogurt example notwithstanding, larger companies are adapting too. Agricultural giant ADM has developed trans-fat-free refried beans and chicken nuggets that are sold in schools, and Nabisco has introduced trans-fat-free snacks. But sometimes meeting nutritional requirements isn't enough. Faced with rules governing vending machines, Unilever's (NYSE:UL) Klondike division offered schools a low-calorie line that it had been marketing to adults. Unhappy with the product (called Slim-a-Bear), vending machine operators approached Tom Mosey, the CEO of a small ice cream company called Mini Melts, based in Norwich, Connecticut. If he changed his recipe so that his kid-friendly packets of ice cream pellets complied with the new dietary rules, they would carry his product.

Mosey asked suppliers to use less sugar and he reduced the portion size. He also cut his suggested retail prices by about a dollar. He justified this by noting that vending machine operators pay lower rental fees in schools, meaning they could take a lower markup. Volume was high and the exposure was good for the brand. The move paid off. School business now accounts for $460,000 in revenue per year. What's more, the line generates margins comparable to the premium-priced ice cream that Mini Melts sells in shopping malls. Now the company is looking to expand into more schools. "The large players don't see this opportunity," Mosey says. "But for us this makes an awful lot of sense."