عَنْ مَّالِكٍ أَنَّهُ بَلَغَهُ أَنَّ عُمَرَ بْنَ الْخَطَّابِ وَعُثْمَانَ بْنَ عَفَّانَ قَضَىٰ أَحَدُهُمَا فِي امْرَأَةٍ غَرَّتْ رَجُلًا بِنَفْسِهَا وَذَكَرَتْ أَنَّهَا هُرَّةٌ، فَوَلَدَتْ لَهُ أَوْلَادًا فَقَضَىٰ أَنْ يُّفْدِيَ وَلَدَهُ بِمِثْلِهِمْ.
Sayyiduna Umar ibn Khattab (may Allah be pleased with him) or Sayyiduna Uthman ibn Affan (may Allah be pleased with him) gave the ruling: If a woman deceives someone by saying, "I am free," then marries and has children, and afterwards it is discovered that she is someone’s slave-girl, then by giving a slave-boy or slave-girl like her children, he can ransom his children.
Imam Malik (may Allah have mercy on him) said that in my view, giving the price is better.