Today, the United States Department of Agriculture spends $8.3 billion a year to provide free and reduced-priced lunches for 30.6 million children whose families are at or below 130 percent of the national poverty level, about $26,845 for a family of four. The program also provides reduced-priced meals for students who are between 130 percent and 185 percent of the poverty level, or $38,203 for a family of four.

Some schools use money raised from à la carte foods to support their subsidized lunch program, often adding choices to the federally financed menu. A Government Accountability Office report found that 90 percent of public schools in 2004 sold à la carte foods. While many have quit selling sodas and sweets, the separate lines remain.

“Anywhere you sell à la carte foods, that automatically means kids who can’t afford to purchase them are being identified,” said Kate Adamick, a lawyer, chef and food systems consultant based in New York.

Most elementary-school children like free lunches, school officials say, but by the time they enter middle school, social status intervenes. And at lunchtime, as students choose with whom to associate, many students from poor families either pay cash or go hungry if they do not bring lunches from home.

“I know kids need to eat but they don’t want to be identified with free food,” said Kenneth Block, a track coach and security guard who oversees the lunch shift at Balboa High.

Attention to the matter in San Francisco came almost by chance.

Last year, Dr. Rajiv Bhatia, director of occupational and environmental health for the San Francisco Department of Public Health, was campaigning to improve the nutritional value of food in schools when he encountered the two-tier system.

Dr. Bhatia grew up in Oklahoma City, where he said he experienced and observed discrimination in the public schools, including students hurling insults at his Indian heritage. He said he was shocked to find that students in San Francisco were facing similar challenges in the lunch line.