All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ʻalayhi wa sallam, is His slave and Messenger.
As long as the contract entails investing the savings in unlawful activities, it is impermissible for a Muslim to partake in it even if this contract has some advantages such as exemption from taxes or the participant has the intention to dispose of the unlawful sum of this money.
A Muslim should only seek sustenance through lawful means and should not seek it through unlawful means. He should know that his sustenance is guaranteed. The Prophet, sallallaahu ʻalayhi wa sallam, said: “The Holy Spirit (Gabriel) revealed to my heart that no soul shall die until its sustenance and term are reached in full. So, fear Allaah and seek it (sustenance) with decency.” [Abu Nu‘aym - Al-Albaani graded it Saheeh (sound) in Al-Jaami‘ As-Saheeh]
Whoever has already taken part in such a transaction is obligated to desist and cancel it if possible. If not, he should dispose of the unlawful money earned through this transaction and the rest of his money is lawful. For more benefit, please refer to Fatwa 88934.
Allaah Knows best.