Praise be to Allah the Lord of the Worlds.
The mosque is a place endowed for delivering different acts of worship, which bring a Muslim closer to Almighty Allah. The mosque`s accommodation is part of it, thus renting or substituting it defies the purpose for which that mosque was endowed in the first place, because the acknowledged principle of the jurisprudents states that changing an endowment isn`t permissible as doing so defies the purpose for which it was endowed.
Although the Imam benefits from the mosque`s accommodation, it isn`t his.Therefore, neither he nor anyone else is allowed to rent it to the Zakat committee or any other party. Al-Kharaafi (May Allah be pleased with him) says, "If a person endows a property as an accommodation, then the beneficiary isn`t allowed to rent it to any party."
However, if the above committee decides to rent a flat at the expense of a certain donor, then there is nothing wrong with that so long as the rent isn`t paid for from the Zakat funds. The committee may also rent a building and pay the rent from the collected donations so long as it had informed the donors about that upon collecting the funds.
In conclusion, it isn`t permissible to use any part of the mosque in favor of the Zakat committee or any other party whose business has nothing to do with the purpose for which the mosque was established in the first place, whether they have the money to rent a flat outside the mosque or not. This is because the legal axiom states that the conditions laid down by the endower are tantamount to the rulings laid down by the Lawmaker. And Allah the Almighty knows best.