Malik related to me that he heard that a man of the Ansar from the tribe of Banu al-Harith ibn al-Khazraj, gave sadaqa to his parents and then they died. Their son inherited the property he had given them and it was palm-trees. He asked the Messenger of Allah ﷺ about it and he said, "You are rewarded for your sadaqa, and take it as your inheritance."
عَنْ ذَلِكَ رَسُولَ اللَّهِ ﷺ فَقَالَ قَدْ أُجِرْتَ فِي صَدَقَتِكَ وَخُذْهَا بِمِيرَاثِكَ