Praise be to Allaah.
Firstly:
Working for the tax department is haraam, because it is
participating in taking people’s wealth unlawfully, unless the one who works
in that intends to reduce the people’s burden, and relieve them of
wrongdoing as much as he is able to, in which case there is nothing wrong
with him doing this job and indeed he will be a doer of good.
This has been discussed in the answer to question no.
39461.
Based on this, there is nothing wrong with you going back to
this job with the aim of reducing the burden for people, and we ask Allaah
to help you to do all that is good.
Secondly:
With regard to the salary that you received before you
learned that it is haraam, there is nothing wrong with it in sha Allaah.
Allaah says concerning riba which is one of the gravest of major sins
(interpretation of the meaning):
“So whosoever receives an admonition from his Lord and
stops consuming Riba, shall not be punished for the past; his case is for
Allaah (to judge)”
[al-Baqarah 2:275]
Allaah allowed them to keep what they had taken of riba
before they came to know that it is haraam.
Similarly, we do not think that there is anything wrong with
the financial rights that the state owes you for the period when you worked
for them.
And Allaah knows best.