Praise be to Allaah.
Firstly:
If the money that is coming to the mosque is zakaah or
sadaqah (charity) and the imam is one of those who are entitled to receive
zakaah or sadaqah, then it is permissible to give it to him just like anyone
else who is entitled to it.
Secondly:
If the money is given as a waqf for the mosque, or it is
donated to the mosque, then it is to be disposed of according to the
conditions stipulated by the donor. If he intended that it should be for the
mosque in general and anything connected to it, such as the houses of the
imam and muezzin, it may be spent on what they need of repairs.
But if he intended that it was to be limited to the mosque
itself, then it should be spent on the mosque only, but if there is money
surplus to the requirements of the mosque and the imam is in need, it is
permissible to give some of it to him.
Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him)
said: It is permissible to give to the imam and muezzin from the surplus
income of the waqf the payment that is usually given to such people; indeed,
if they are poor and nothing has been specified about how to spend any
surplus funds, then it is permissible to give it to them to ensure that they
can make ends meet.
And he said: Hence the correct opinion with regard to waqfs
is this opinion, and he may be given anything that is surplus to clothe him,
as ‘Umar ibn al-Khattaab used to give the covering of the Ka’bah in charity
every year, dividing it among the pilgrims.
If that is the case, then it is well known that giving the
surplus to the imam and the muezzin, if they are entitled to it, is better
than giving it to anyone else, and even if the donor specified how the money
is to be spent, the surplus may be spent on something other than what was
specified by the donor, or it may be spent on a mosque other than this
mosque.
End quote from Majmoo’ al-Fataawa, 31/17
And Allaah knows best.