he benefits from society, then…
He gives benefit to society. That’s how he gets rich: by giving a benefit to society, and his riches represent the unpaid recompense from society back to him.
If he were living, he could, for instance, buy a restaurant meal with that money. In that way, society would pay him back by cooking him a meal at the restaurant.
Instead he leaves the money to his children, and they - for instance - buy a car. Then, society pays back the man who benefited them by providing a car to his child.
Well, sure, wealth acquired unjustly is not made okay by inheriting it. But I feel that’s a separate question from that of inheritance.