His work gave him the task of buying an apartment; does he have any right to the broker’s fee?
Question

I am an administrative employee of the state (civil servant) in charge of accounts, preparing and equipping. Recently I was given the task by the department of buying an apartment within the capacity of equipping. Because I am a stranger to the area where I work, I got in touch with a trustworthy person and told him about the matter, i.e., so that he could be like an intermediary in looking for an apartment, and he accepted. Then we visited a number of apartments to find a suitable one, and finally we found it. I was looking with him without that affecting my original work, i.e., in the office my work was always complete. I understood that he – meaning the middle man – would take a share of this commission with the knowledge of the owner of the property. My question is:
1. Can I take a share of this commission, knowing that the owner of the property is aware of this share that I am going to take, but the purchaser -- meaning my employer -- will not be aware of that?
2. If the broker – i.e., the middle man – said to me: “If the transaction is completed successfully, I will give you a share,” knowing that if he gives it to me, he will tell the owner of the property, is this money halaal or haraam? Please note that put in a great deal of effort with him to find this apartment as I was acting as a deputy [on behalf of my employer], and I did not stipulate any conditions for the middleman or the seller; rather he said to me: “I will give you a share willingly”. Please note that I did not cheat or deceive with regard to the price. I was looking sincerely and with a good intention for a suitable property without letting that affect my regular work, i.e., I persisted in doing my regular work: even if I had to leave during working hours, I would make up for it by doing extra time.
Praise be to Allah.You say that you are in charge of accounts, preparing and equipping, and that buying the apartment came under the heading of equipping. Based on that, the work that you did is part of the work for which you are paid a salary, so you do not have the right to take anything from either the buyer or the broker, because this comes under the heading of what is called “gifts to workers”, which is haraam wealth. 
The Prophet (blessings and peace of Allah be upon him) appointed a man in charge of collecting zakaah. When he came he said: This is for you, and this was given to me. The Messenger of Allaah (blessings and peace of Allah be upon him) stood up on the minbar and praised and glorified Allaah, and said: “What is the matter with a worker whom I send, and he comes and says, ‘This is for you and this was given to me’? Why doesn’t he sit in the house of his father or the house of his mother and see if he is given anything or not?” 
Narrated by al-Bukhaari (7174) and Muslim (1832). 
Al-Nawawi (may Allah have mercy on him) said: In this hadeeth we see that gifts to workers are haraam, because it is a betrayal of his position and what has been entrusted to him. In the same hadeeth, the Prophet (blessings and peace of Allaah be upon him) explained the reason why gifts to workers are haraam: it is because the worker is only given that gift because of his position. So it is not like a gift to someone other than the worker, because such gifts are mustahabb. The ruling on that which is taken by a worker and the like in the name of it being a gift is that it should be returned to the giver, and if he refuses (to take it back) it should be added to the bayt al-maal. End quote. 
Based on this, if you took something from the buyer or broker, you have to give it back to him. 
For more information, please see the answer to question no. 87864.