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.
These amounts of money, collected as taxes, are paid by people for their commission of sinful acts, like someone who pays money to commit adultery or another to gamble. This money should not be given back to those who paid them, as this will constitute an act of assistance for them in their evil actions. So, in such case the money should be given as charity to those who deserve it. As-San‘aani quoted Ibn Al-Qayyim as saying that such money should in any case be given as charity and not returned to its payer, because he paid it willfully in return for some end; such money is now filthy and ill-gotten and ought to be spent in charity; the sinner should not be assisted by permitting him to commit the sin and take back his money.
In this regard, Ibn Al-Qayyim said:
If the money is paid willingly by someone who got his prohibited end in return, such as the person who pays for wine, pork, or adultery, it should not be paid back to him; he gave it voluntarily and received the forbidden substitute. So, he should not be allowed to take both the money and what it is paid for. This cannot be approved by the Sharee‘ah.
Hence, we say to the questioners that they may take the money and spend it on poor and needy Muslims.
Allaah Knows best.