Should he return money that he took from his friend which came from selling gambling accounts?
Question

In 2019 one of my friends whom I got to know through Facebook offered to set up an admin account for me on one of the new gambling websites, and I agreed to that because my faith was weak at that time, and because I needed money. My role in the account that he set up for me was to create player accounts for customers, meaning that the customer would come to me and say: I want to play on your website. So I would set up an account for him and put credit in his account. My profit in this operation is by taking the difference between the price for which I buy the credit from my friend who set up the account for me, and the price for which I sell it to the customer. What matters here is that every time I sell the credit that he sends to me, I immediately send his money to him and keep my share. This transaction is all done online, and we have never met in real life. What matters is that on one occasion I needed some money, and I could not find anything except money that belonged to him, so I took it without his knowledge, on the basis that I would be able to collect the same amount again soon. But unfortunately I was not able to do that, and we argued about this matter, but I promised him that I would return his money, and I was sincere in what I said. Some time after this incident, Allah blessed me by enabling me to repent, and I gave up gambling and haraam things by Allah’s grace and mercy. My question is: when I collect this amount of money, is it permissible for me to give it to him or not?
Praise be to Allah.Firstly: It is not permissible to make accounts for gamblers
It is not permissible to make accounts for gamblers, because that comes under the heading of helping in sin and transgression, and Allah, may He be exalted, says (interpretation of the meaning): “And cooperate in righteousness and piety, but do not cooperate in sin and transgression. And fear Allah; indeed, Allah is severe in penalty” [al-Maa’idah 5:2].
And the Prophet (blessings and peace of Allah be upon him) said: “Whoever calls people to guidance will have a reward like that of those who follow him, without that detracting from their reward in the slightest. And whoever calls people to misguidance will have a burden of sin like that of those who follow him, without that detracting from their burden of sin in the slightest.” Narrated by Muslim (4831).
The money that resulted from this work is haraam, because it is in return for an unlawful benefit.
Secondly: What should a person do who hired someone to do haraam work then he repented?
We have previously noted in the answer to question no. 303583  that if a person hires someone to do haraam work then he repents, he should not pay that worker his wages; rather he should give that money in charity. The same applies to someone who buys something that is haraam, such as wine; he should not give its price to the seller; rather he should give it in charity, because it is wealth that is given in return for an item or benefit that is unlawful.
Ruling on one who borrows or transgresses against wealth that is haraam because of the manner in which it is acquired
With regard to someone who borrows or transgresses against wealth that is haraam because of the manner in which it is acquired, then what appears to be the case is that he must return it, and the sin of acquiring it is on the one who acquired it.
Your taking some of your friend’s wealth without his permission is a kind of transgression, which comes under the rulings on usurping wealth. Therefore you must return the money to him, and advise him to give up what is haraam.
But does your friend have to get rid of this wealth? That is subject to further details:
1.. With regard to whatever he took before he came to know that it is haraam, it is permissible for him to make use of it.
2.. With regard to whatever he took after he came to know that it is haraam, he must get rid of it by giving it to the poor and needy, or spending it on public interests, unless he needs it, in which case he may take as much of it as he needs.
Shaykh al-Islam said: If this prostitute and wine seller have repented, and they are poor, it is permissible for some of this wealth to be given to them, commensurate with their need. If he is able to do business or practice a craft such as weaving and spinning, he may be given capital from that wealth [to set up in trade], but if they borrow some of that money in order to start earning a living, that is better.
End quote from Majmoo‘ al-Fataawa (29/308).
See also the answer to question no. 78289 .
And Allah knows best.