She is famous for her Rice Krispie Buns, which she makes with semisweet dark chocolate instead of marshmallows. The bake-sale money has also gone to send students to the Adirondacks for a four-day “nature’s classroom” in the summers, quite a benefit for a school where she said 60 percent of the students meet the federal poverty standard.

Image Credit... Lars Klove for The New York Times

“A lot of families in our school don’t have money, but if they’re baking something they feel they are contributing,” said Ms. Neary, a past president of the PTA. “If they can’t give me money and they can’t give me time, they give me some brownies, they give me some cupcakes.”

School officials say parents have misinterpreted the ban as an endorsement of junk food.

“We’re not saying you should eat Doritos,” said Eric Goldstein, chief executive of School Food and Transportation for the Department of Education. “We’re not telling you what you can feed your child or not feed your child. If you want to send in with your child 15 cupcakes you can do so. That probably wouldn’t be advisable. But what we’re talking about is the selling of food. We’ve taken a good long look at this.”

He said that 40 percent of the 1.1 million city schoolchildren are overweight or obese and that restricting the sale of baked goods was just “one piece in a holistic wellness puzzle,” coming after the school system had replaced much of the food in its vending machines with items lower in calories, fat and sodium. Listing the ingredients of food for sale in school is essential to monitoring what students eat, Mr. Goldstein said.

But Laura Shapiro, a food historian and author, said the city’s argument was “exactly the kind of thinking that sent us down the road of packaged, industrial junk food in the first place.”

Big food companies, she said, came “roaring out of World War II, producing every kind of food and getting people to eat this stuff,” and “that was the start of a kind of war between the food industry and American home cooks, which this bake-sale flap shows is not over.”

She added: “Americans came to accept a kind of distance between themselves and food. You wouldn’t trust it if it wasn’t wrapped up and labeled. Now, farmers’ markets are in vogue  we love to exalt in that  but for many decades you only bought a bag of potatoes, cut up and wrapped and predone.”