A presidential aide said 101 schoolgirls were dropped back in the town in the early hours of Wednesday.
The government said the army allowed the militants through, so “lives were not lost”, but denied paying a ransom.
However, reports suggest at least five girls died during their kidnapping, and that a Christian girl remains captive.
One of the freed girls, in a phone conversation with a relative, said the five had been crushed to death as they were herded into vehicles and driven away.
The girl said they were taken into the bush, to an “enclosed place”. When asked whether they were well fed, she said they had to cook their own food.
The government did not make any mention of deaths.
‘No ransom paid’
The father of one girl said she was being kept by the militants – thought to be from the Boko Haram group – because she refused to convert from Christianity to Islam. In a radio interview he said he was happy that she had not renounced her faith.
The BBC’s Tomi Oladipo says the government is likely to have given something in return for the girls’ release.
But Nigeria’s Minister of Information and Culture, Alhaji Lai Mohammed, told Reuters that “no ransom was paid”.
In Dapchi there was jubilation and shock at the unexpected arrival of the girls.
One of the girls’ parents, Kundili Bukar, told the BBC the militants drove into the town in a motorcade in the early hours of Wednesday morning and surrendered the girls to the community.
The militants are said to have left immediately. However, another parent told the BBC the extremists left them with a warning not to send their daughters back to school, threatening to return and kidnap them once more – only this time, there would be no chance of release.
The girls, who are described as being hungry and looking tired by parents, have been taken to hospital.