Most students are exposed in school to efforts by food and beverage companies to sell food or gain brand loyalty, despite a decline in some kinds of commercial enterprises, including in soda machine contracts, researchers reported Monday.

High school students get the most exposure, and for almost 64% of elementary school students, the most common type of commercialism is food coupons distributed as incentives, the researchers wrote in the Journal of the American Medical Assn. Pediatrics.

The study was based on surveys of administrators at a representative sample of schools from 2007 through 2012, and conducted by Yvonne Terry-McElrath of the University of Michigan and colleagues.

"Schools are desirable marketing areas for food and beverage companies, although many of the products marketed to students are nutritionally poor," the authors wrote.

"School property should be a place where messages to young people strengthen their bodies as well as their minds," Jennifer Harris of the Rudd Center for Food Policy and Obesity wrote in an editorial accompanying the study. Harris noted that while some states and districts had removed unhealthful products from schools, those moves generally did not restrict marketing; only Maine has legislation doing that.

"How can schools effectively teach good nutrition when the products they tell children to limit are featured in school halls, cafeterias, vending machines and athletic fields?" Harris wrote.

The study authors include sponsorship, exclusive contracts, incentive programs, advertising, fundraising and branded products sold in schools in their definition of commercialism. So a fast-food company's weekly lunch for fifth-graders, or ads posted on school fences, or coupons for good grades all would be included.

In 2006, food and beverage companies spent $186 million on youth-directed in-school marketing, the study said. That year and the next, the federal government issued recommendations for changes. By 2009, the spending had fallen to $149 million, the authors said. In 2011, about a tenth of districts in the U.S. prohibited unhealthful food and beverage marketing. In fact, many used profits from such relationships to make up for budget shortfalls.

In middle and high schools, the most prevalent commercialism came through exclusive beverage contracts. Almost 70% of high school students and nearly half of middle school students went to schools with such contracts in 2012, the researchers wrote.

The researchers said their results showed a need for "at minimum, clear and enforceable standards on the nutritional content of all foods and beverages marketed to youth in school settings."

There was a decrease in students at schools with exclusive beverage contracts; by 2012, it was 2.9% of elementary school students, compared with 10.2% in 2007; 49.5% of middle school students, compared with 67.4% in 2007; and 69.8% of high school students, compared with 74.5% in 2007.

Policy changes and legislation, including in California, have limited the sugary sodas that can be sold on school grounds. In addition, the companies have adopted voluntary restrictions on some drinks. Sports beverages are still sold at many schools.

The U.S. Department of Agriculture recently published standards that would, if they become final, govern "competitive food" sales - those sold aside from the school meals program. Those rules do not address in-school marketing.

The authors note that declines in public funding for schools have left 35 states with 2012 funding below 2008 levels. "School districts must make up the difference, and one possibility is additional revenue through school-based commercialism," they wrote.

But that marketing conflicts with the need to raise children to be critical thinkers who can effectively evaluate a consumer society, they said. "Also, most foods and beverages marketed in any venue toward children and adolescents are high in calories, sugar, salt and fat, and are low in essential nutrients."