He—may Allah have mercy on him—was asked:
A man had some unlawfully acquired dirhams. He gave them to his father and received lawful dirhams from him in exchange. With these, he purchased something yielding a benefit—whether offspring from camels and sheep or crops from a plot of land—and made use of it. Is this unlawful or not?
He answered:
Whenever someone exchanges unlawful wealth for an equivalent amount, the substitute has the same ruling as what it replaces. If, through his own efforts, he generates an increase, whether profits, earnings or otherwise, the scholars differ concerning it. The most equitable view is that the increase should be apportioned according to the respective contributions of the capital and the worker, as in a profit-sharing partnership. This is what Umar ibn al-Khattāb—may Allah be pleased with him—did regarding the money from the public treasury with which his children traded. The same applies to every increase arising from two contributing sources, when the original asset is sold.
He also answered:
The most equitable view in this matter and similar cases is that the crop produced through the contributions of the land, seed, worker and cattle should be apportioned among these contributing sources. The share attributable to what is unlawful should be disbursed to whoever must receive it, and the share attributable to what is lawful should go to whoever is entitled to it, as with all other proceeds arising from jointly contributing sources.