42 They will throw them into the fiery furnace, where there will be weeping and gnashing of teeth. 43 Then the righteous will shine like the sun in the kingdom of their Father. The one who has ears had better listen! 44 “The kingdom of heaven is like a treasure, hidden in a field, that a person found and hid. Then because of joy he went and sold all that he had and bought that field. 45 “Again, the kingdom of heaven is like a merchant searching for fine pearls. 46 When he found a pearl of great value, he went out and sold everything he had and bought it.
Mekhilta d'Rabbi Ishmael 62:5Halakhic Midrash
Variantly (Exodus 14:5) "And the heart of Pharaoh and of his servants was reversed against the people. And they said: What is this that we did in sending Israel away from serving us?" They said to him: Would we not have gained much good from them? R. Yossi Haglili says: An analogy: A man inherits a beth kor (of land) and sells it for a pittance — whereupon the buyer goes and opens springs in it and plants in it gardens and orchards — whereupon the seller begins "choking" (at what he did)! Thus, with Egypt. They sent without realizing what they were sending. Of them it is written in the Tradition (Song of Songs 4:13) "Your 'sendings' are an orchard of pomegranates!" Variantly: R. Shimon b. Yochai says: An analogy: A man inherits a country-seat across the seas and he sells it for a pittance — whereupon the buyer goes and digs in it and finds in it treasures of silver and of gold and precious stones and pearls — whereupon the seller begins "choking." Thus with Egypt. They sent without realizing what they were sending, viz.: "What is this that we did, etc."
Notes and References
"... The situation described here resembles the one described in the Gospel of Thomas and the Mekhilta on Exodus 14:5 (with its later parallels): the buyer of a property finds a treasure in it of which the seller was not aware. In Matthew 13:44, on the other hand, the treasure is found before the field is purchased. In contrast to the parable in the Gospel of Thomas 109, where the buyer uses the treasure for his own benefit on the assumption that it belongs to him, the rabbinic story in the Alexander narrative problematizes the ownership issue and has both the buyer and seller distance themselves from ownership of the find. None of them wants to appear greedy. Both try to uphold their moral inculpibility. In the context of mishnaic law, the solution to the case is uncertain. On the one hand, one could argue that the treasure, if bundled, would be identifiable by the owner; on the other hand, the seller forsakes possession of the field and everything it contains. Theoretically, both could claim ownership of the treasure, but in the story both decide to abandon it ..."
Hezser, Catherine Finding a Treasure: The Treasure Motif in Jewish, Christian, and Graeco-Roman Narratives in the Context of Rabbinic Halakhah and Roman Law (pp. 295-325) Mohr Siebeck, 2019