Praise be to Allah the Lord of the Worlds. May His peace and blessings be upon our Prophet Mohammad and upon all his family and companions.
According to the general rule, everything placed in a mosque is considered a Waqf for the benefit of all Muslims and take the rulings of Waqf. Islamic law has specific rules and conditions that make the dedicated property a source of benefit for the intended beneficiaries. It is not owned by anyone, and no one is allowed to dispose of it without a valid reason. Whatever is placed in mosques, such as furniture and the like, with the intention of benefiting the Muslims takes the ruling of a waqf where it remains for their general benefit, and anything dedicated to a specific mosque should stay there. It should not be transferred except for a valid religious reason, respecting the intention of the donor. Therefore, it is not permissible to dispose of the dedicated property through selling, buying, gifting, or lending it to a specific party, as doing so would hinder its intended purpose, which is for the general benefit of the Muslim community.
As for the items that have been dedicated and, over time, become damaged or unusable, such as prayer rugs, books, or other similar objects, it is permissible to sell or transfer them to another mosque when it is established that they can no longer serve their purpose in the original mosque. This is especially true if these items have become a burden to the mosque. Moving them to another mosque helps achieve the purpose of the endowment, even if it is in a different location than initially specified. Not transferring them would result in a total loss of benefit. Therefore, transferring such items to another mosque is permitted in the interests of preserving and realizing the intended benefits of the endowment for the general good of the Muslim community.
Imam Al-Nawawi, may Allah have mercy on him, stated, "If the mosque`s prayer rugs become damaged, its woodwork deteriorates, and the Kiswa (the covering of the Kaaba) no longer serves any purpose nor adds to its beauty, then it is permissible to sell them. There are two reasons for allowing this: the first and more valid reason is to sell them to prevent their loss and occupy the space without benefit." {Rawdat At-Talibin, Vol.5, Page 357}. "Transferring items like the prayer mats and the mosque's lamps is similar to transferring the mosque's tools. If the mosque does not need them, they can be moved to another mosque. If they are needed, it is not permissible to transfer them." {I`anat At-Talibin, Vol. 3, Page 215}.
In conclusion, it is worth reminding that the authorities responsible for the endowment funds have the final say in these matters, as they are the ones who decide what is most suitable and appropriate. And Allah the Almighty knows best.