All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah and that Muhammad is His slave and Messenger.
Shaykh Ibn Taymiyyah said in his book Iqtidhaa’ As-Siraat Al-Mustaqeem, “Thus, it was reported to us that some of the attendants of Al-Madeenah came to the grave of the Prophet and asked him for some kind of food, then some Hashemites came to that person and said to him that the Prophet sent him that food and said to him: 'Go away because those who come to us do not desire such a thing.'”
Ibn Taymiyyah said before this, “It is based on this that many people commit a mistake as it was reported to them that some righteous people did an act of worship or said a supplication and then found the effect of that act of worship or supplication, so they use this as evidence that such an act of worship or supplication is desirable or consider such an act a Sunnah, as if a Prophet did it, while this is wrong as we have mentioned...”
Then he mentioned a number of stories among which is the one mentioned in the question.
There is no doubt that these stories are reported without ascertaining whether or not they are authentic, and it is likely that the devil had a role in these stories in order to confuse the people. Indeed, these stories do not lead to an Islamic ruling; and it is for this reason that Ibn Taymiyyah said in his statement above: “…they consider such an act a Sunnah, as if a Prophet did it, while this is wrong….”
Allaah Knows best.