It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that among the captives of Badr were people who had nothing to pay as ransom, so the Messenger of Allah (peace and blessings be upon him) set their ransom as teaching the children of the Ansar to write. A boy of the Ansar went to his father, who asked: "What is the matter?" The boy said: "My teacher hit me." The father said: "That wicked man is seeking revenge for Badr. By Allah, do not go to him anymore."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب قسم الفيء والغنيمة / 12847