The poisoning occurred in the village of Dharmasati Gandaman, 80km (50 miles) north of the state capital, Patna.
The free Mid-Day Meal Scheme aims to tackle hunger and boost attendance in schools, but suffers from poor hygiene.
Angry parents joined protests against the deaths, setting at least four police vehicles on fire.
An inquiry has begun and 200,000 rupees ($3,370) in compensation offered to the families of each of the dead.
Twenty-eight sick children were taken to hospitals in the nearby town of Chhapra after the incident and later were moved to Patna.
A total of 47 students of the primary school fell sick on Tuesday after eating the free lunch.
There are fears the number of dead could rise as some of the children, all below the age of 12, are critically ill.
The father of one sick child, Raja Yadav, said his son had been vomiting after returning from school and had to be rushed to hospital.
By Soutik BiswasIndia correspondent
In a country where nearly half of the children are undernourished and struggle to go to school, the school meal programme is a weapon to tackle hunger and illiteracy
Economists believe the programme bolsters primary school enrolment and attendance, eliminates hunger, enables children from diverse class and caste backgrounds to share a meal together and bury social prejudices, and provides children with hygiene and nutritional education.
There is enough evidence to prove, they say, that the programme, by and large, has been a success.
That's precisely why the deaths of more than 20 school children after consuming contaminated free meals in Bihar state is shocking.
The state education minister, PK Shahi, told the BBC a preliminary investigation indicated that the food was contaminated with traces of phosphorous.
"The doctors who have attended are of the tentative opinion that the smell coming out of the bodies of the children suggests that the food contained organo-phosphorus, which is a poisonous substance," he said.
"Now the investigators have to find out whether organo-phosphorus was accidental or there was some deliberate mischief."
Earlier, doctors treating the patients had said "food poisoning" was the cause of the deaths.
"We suspect it to be poisoning caused by insecticides in vegetable or rice," Amarjeet Sinha, a senior education official, told the BBC.
A doctor treating the children at a hospital in Patna said contaminated vegetable oil could have led to the poisoning.
Patna-based journalist Amarnath Tewary says villagers told local reporters that similar cases of food poisoning after having Mid-Day Meals had taken place in the area previously.
Bihar Chief Minister Nitish Kumar called an emergency meeting and ordered a team of forensic experts to the school, which is in Saran district.
Bihar is one of India's poorest and most populous states.
The Mid-Day Meal is the world's largest school feeding programme, reaching 120 million children in 1.2 million schools across the country, according to the government.
Mr Shahi acknowledged "that food is not being checked before it is being served".
He added that "the scale at which the operation is being carried out, serving food to 20 million children every day and that too in remotest village schools, checking food before it is served - that itself is a challenge".
The Mid-Day Meal was first introduced for poor and disadvantaged children in the southern city of Chennai (Madras) in 1925.

Police said the incident happened at the corner of Jamaica Street and Argyle Street at about 09:45.
Emergency services attended and the man was taken by ambulance to Glasgow Royal Infirmary. There is currently no information on his condition.
Jamaica Street has been closed while police carry out investigations into the circumstances of the incident.
At least 22 children have died and dozens more have fallen ill after eating lunch at a school in the eastern Indian state of Bihar.
[NEXT_CONCEPT]
A man is being treated in hospital after he was struck by a bus in Glasgow city centre.