Praise be to Allah.
It is not permissible for him to do that, and it should be knocked down. (Words of Imaam al-Nawawi).
Taking graves as mosques or places of worship is one of the customs of the Jews with whom Allaah is angry. Abu Hurayrah (may Allaah be pleased with him) reported that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: May Allaah destroy the Jews! They have taken their graves as places of worship.(Agreed upon). Ibn Abbaas (may Allaah be pleased with him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) cursed the women who visit graves and those who build mosques over them and place lamps on them. Some of them claim that this was because at that time they were still close to the time when people had worshipped idols, but Ibn Daqeeq al-Eed refuted this argument. This indicates that it is haraam to place lamps on graves because this could lead to false beliefs.
In addition to the issue of building mosques over graves, this person's actions also involve going against the conditions set by the one who endowed this land. Moreover, he is denying the Muslim dead space in which to be buried. Adding any extra structure over a grave as the ignorant people among the Muslims do is haraam, as stated by the fuqaha and ulama, let alone building mosques over graves. So the imaam (Imaam al-Nawawi) ruled that whatever mosques had been built over the graves should be torn down.
(Comment in the margin of Fataawa al-Imaam al-Nawawi, p. 65).