Short answer
In one discourse, the Buddha refuses to have his monks show wonders to ordinary people, and says such displays disgust him. A layman had asked for one, so that the town would become even more devoted to the Buddha. Yet the monks' rule book has the Buddha himself work wonder after wonder for a fire-worshipping ascetic named Kassapa. One of them was reading his mind. After each one, Kassapa accepted the power, and still thought himself holier. He asked to join only when the Buddha told him plainly that he was not holy. In the Qur'an, when people demand signs, the Prophet (ﷺ) answers that the signs are with God (﷾), and that he is a warner.
Full explanation
Disgusted by displays of power
One of the Long Discourses is the discourse to Kevaddha. These discourses are in the Pali canon, the scriptures of Theravada Buddhism. In it, a householder asks the Buddha to have a monk perform a wonder, so that the town of Nalanda will become even more devoted. The Buddha says he does not teach his monks to do this for ordinary people. He names three kinds of display: psychic power, revealing other people's thoughts, and instruction. A doubter, he says, would claim the first two were done by a spell. Seeing this drawback, he is horrified, repelled and disgusted by both. He approves only instruction, teaching people how to think and live.
“Then the householder Kevaḍḍha went up to the Buddha, bowed, sat down to one side, and said to him, "Sir, this Nāḷandā is successful and prosperous, populous and full of people. Please direct a mendicant to perform a superhuman demonstration of psychic power. Then Nāḷandā will become even more devoted to the Buddha!" When he said this, the Buddha said, "Kevaḍḍha, I do not teach Dhamma to the mendicants like this: 'Come now, mendicants, perform a superhuman demonstration of psychic power for the white-clothed laypeople.'"”
“"But the one lacking faith and confidence would say to them: 'There's a spell named Gandhārī. Using that a mendicant can perform such superhuman feats.' What do you think, Kevaḍḍha? Wouldn't someone lacking faith speak like that?" "They would, sir."”
“Seeing this drawback in psychic power, I'm horrified, repelled, and disgusted by demonstrations of psychic power.”
“And what is the demonstration of revealing? It's when a mendicant reveals the mind, mentality, thoughts, and reflections of other beings and individuals: 'This is what you're thinking, such is your thought, and thus is your state of mind.'”
“Seeing this drawback in revealing, I'm horrified, repelled, and disgusted by demonstrations of revealing.”
“And what is the demonstration of instruction? It's when a mendicant instructs others like this: 'Think like this, not like that. Focus your mind like this, not like that. Give up this, and live having achieved that.' This is called the demonstration of instruction.”
Fire against fire
The Mahavagga, part of the Vinaya, the monks' rule book, tells how the Buddha came to Uruvela. There lived Kassapa, the leader of five hundred matted-hair ascetics who tended a sacred fire. The Buddha spent the night in his fire room with a fierce serpent king. He met its fire with his own, and in the morning showed it tamed in his alms bowl. Kassapa thought the Buddha had great magical powers, but: "He is not, however, holy (araha) as I am."
“That night having elapsed, the Blessed One, leaving intact the skin and hide and flesh and ligaments and bones and marrow of that Naga, and conquering the Naga's fire by his fire, threw him into his alms-bowl, and showed him to the Gatila Uruvela Kassapa (saying), 'Here you see the Naga, Kassapa; his fire has been conquered by my fire.' Then the Gatila Uruvela Kassapa thought: 'Truly the great Samana possesses high magical powers and great faculties, in that he is able to conquer by his fire the fire of that savage Naga king, who is possessed of magical power, that dreadfully venomous serpent. He is not, however, holy (araha) as I am.'”
Reading Kassapa's mind
Later, a great sacrifice that Kassapa used to hold drew near. He thought that if the Buddha performed a wonder before that great crowd, the Buddha's gain and honour would grow, and his own would shrink. So he wished the Buddha would stay away. The Buddha knew this thought by the power of his mind. He stayed away, and told Kassapa so the next day. Again Kassapa accepted the power: "He is not, however, holy like me." This is the display of revealing thoughts that, in the discourse to Kevaddha, the Buddha says disgusts him.
“At that time a great sacrifice which the Gatila Uruvela Kassapa used to celebrate was approaching, and all the people of Anga and Magadha wished to go to that sacrifice carrying abundant food, both hard and soft. Now the Gatila Uruvela Kassapa thought: 'Presently my great sacrifice is approaching, and all the people of Anga and Magadha will come and bring with them abundant food, both hard and soft. If the great Samana should perform a wonder before that great assembly, gain and honour would increase to the great Samana, and my gain and honour would diminish. Well, the great Samana shall not appear here to-morrow.' Then the Blessed One, understanding by the power of his mind this reflection which had arisen in the mind of the Gatila Uruvela Kassapa, went to Uttara Kuru; having begged alms there, he took the food (he had received) to the Anotatta lake; there he took his meal and rested during the heat of the day at the same place.”
“'Now I understood, Kassapa, by the power of my mind this reflection which had arisen in your mind, and I went to Uttara Kuru; having begged alms there, I took the food to the Anotatta lake; there I took my meal and rested during the heat of the day at the same place.' Then the Gatila Uruvela Kassapa thought: 'Truly the great Samana possesses high magical powers and great faculties, since he is able to understand by the power of his mind the thoughts of other people. He is not, however, holy like me.'”
“And what is the demonstration of revealing? It's when a mendicant reveals the mind, mentality, thoughts, and reflections of other beings and individuals: 'This is what you're thinking, such is your thought, and thus is your state of mind.'”
“Seeing this drawback in revealing, I'm horrified, repelled, and disgusted by demonstrations of revealing.”
Wonder after wonder
The main story goes on. When the ascetics could not split their fire-wood, the Buddha asked Kassapa whether it should be split, and in a moment the five hundred pieces were split. Kassapa thought the same again. Fires that would not light or go out followed. A closing paragraph totals the wonders at three thousand five hundred. Its nineteenth-century translators note that this paragraph is evidently a remark added to the text by a reader or commentator.
“At that time one day the Gatilas, who wished to attend on their sacred fires, could not succeed in splitting fire-wood. Now these Gatilas thought: 'Doubtless this is the magical power and the high faculty of the great Samana that we cannot succeed in splitting fire-wood.' Then the Blessed One said to the Gatila Uruvela Kassapa: 'Shall the fire-wood be split, Kassapa?' 'Let it be split, great Samana.' Then in a moment the five hundred pieces of fire-wood were split. And the Gatila Uruvela Kassapa thought: 'Truly the great Samana possesses high magical powers and great faculties, since even the fire-wood splits itself (at his command). He is not, however, holy like me.'”
“At the command of the Blessed One the five hundred pieces of fire-wood could not be split and were split, the fires could not be lit up and were lit up, could not be extinguished and were extinguished; besides he created five hundred vessels with fire. Thus the number of these miracles amounts to three thousand five hundred.”
What finally won him
In the end, the Buddha thought that this foolish man would go on thinking for a long time: "He is not, however, holy like me." So he told Kassapa plainly that he was not holy, and was not on the path. Only then did Kassapa ask to become a monk.
“Then the Blessed One thought: 'This foolish man will still for a long time think thus: "Truly the great Samana possesses high magical powers and great faculties; he is not, however, holy like me."' And the Blessed One said to the Gatila Uruvela Kassapa: 'You are not holy (araha), Kassapa, nor have you entered the path of Arahatship, nor do you walk in such a practice as will lead you to Arahatship, or to entering the path of Arahatship.'”
Two pictures in one canon
The Buddha's reason for refusing wonders was that they do not prove the teacher: an onlooker can explain them away. Kassapa's story shows the same weakness in another form. After every wonder he granted the power and still thought himself holier. Yet the rule book has the Buddha perform wonders again and again, including the mind reading he called disgusting. Both books are in the Pali canon, and they give two pictures of him that do not fit together.
“"But the one lacking faith and confidence would say to them: 'There's a spell named Gandhārī. Using that a mendicant can perform such superhuman feats.' What do you think, Kevaḍḍha? Wouldn't someone lacking faith speak like that?" "They would, sir."”
“Seeing this drawback in revealing, I'm horrified, repelled, and disgusted by demonstrations of revealing.”
“'Now I understood, Kassapa, by the power of my mind this reflection which had arisen in your mind, and I went to Uttara Kuru; having begged alms there, I took the food to the Anotatta lake; there I took my meal and rested during the heat of the day at the same place.' Then the Gatila Uruvela Kassapa thought: 'Truly the great Samana possesses high magical powers and great faculties, since he is able to understand by the power of his mind the thoughts of other people. He is not, however, holy like me.'”
“Then the Blessed One thought: 'This foolish man will still for a long time think thus: "Truly the great Samana possesses high magical powers and great faculties; he is not, however, holy like me."' And the Blessed One said to the Gatila Uruvela Kassapa: 'You are not holy (araha), Kassapa, nor have you entered the path of Arahatship, nor do you walk in such a practice as will lead you to Arahatship, or to entering the path of Arahatship.'”
Signs belong to God (﷾)
Unbelievers asked why no sign was sent down to the Prophet (ﷺ). The Qur'an told him to say that the signs are with God (﷾), and that he is a clear warner. It asked whether the Book recited to them was not enough. When the moon was split as a sign, the Qur'an says, they turned away and called it magic. In the Qur'an every sign is God's (﷾) act, and it never condemns a sign. It names the Book as sign enough.
“And the Unbelievers say: "Why is not a sign sent down to him from his Lord?" But thou art truly a warner, and to every people a guide.”
“Say: "The signs are indeed with Allah: and I am indeed a clear Warner." And is it not enough for them that we have sent down to thee the Book which is rehearsed to them? Verily, in it is Mercy and a Reminder to those who believe.”
“The Hour (of Judgment) is nigh, and the moon is cleft asunder. But if they see a Sign, they turn away, and say, "This is (but) transient magic."”
The usual answers
Sahih al-Bukhari 3637 — Kitab al-Manaqib (Virtues and Merits), hadith 3637
Anas ibn Malik reports that the people of Mecca asked the Messenger of Allah to show them a sign, and he showed them the moon split.
Cited for
Hadith say the people of Mecca asked the Prophet (ﷺ) for a sign, and he showed them the moon split.
The response
The Qur'an names that split moon as a sign, and says those who saw it called it magic and turned away. The Prophet (ﷺ) never called signs disgusting, and the Qur'an says signs are with God (﷾). So what he said about signs and what the reports tell agree. The Buddha's own words condemn the very wonders his rule book has him perform.
Where it lands — The Qur'an and the Prophet (ﷺ) agree about signs. The Pali canon has the Buddha condemn the very wonders it has him perform.
Perspectives
Theravada Buddhist
The Buddha refused to have monks work wonders for laypeople. Uruvela was different: he tamed proud ascetics, and he did it himself.
In the discourse to Kevaddha the Buddha refuses to have monks work wonders for laypeople. Kassapa was an ascetic, not a layman, and it was the Buddha himself who acted.
Rebuttal
The reason he gave applies to any audience: a wonder does not prove the teacher, because the onlooker can explain it away. Kassapa did just that. He granted the power each time and still thought himself holier.
The wonders only prepared Kassapa. In the end it was the Buddha's plain words that won him, just as the discourse to Kevaddha says only instruction truly works.
Rebuttal
Yet the rule book has the Buddha work wonder after wonder, including reading Kassapa's mind. That is the very display of revealing thoughts that he called disgusting. And by his own thought, the wonders had not worked: this foolish man would go on thinking himself holier.
The ban in the discourse to Kevaddha is for monks. A Buddha may work wonders.
Rebuttal
In that discourse the disgust is his own: "I'm horrified, repelled, and disgusted by demonstrations of psychic power", and by demonstrations of revealing too. The rule book has him do both.
What the texts say
One Pali discourse has the Buddha disgusted by displays of psychic power and mind reading. The Pali rule book has him use both to win Kassapa.
In the discourse to Kevaddha, the Buddha speaks of displays of psychic power and of revealing thoughts. He says he is horrified, repelled and disgusted by them.
The Mahavagga, part of the monks' rule book, has him tame a serpent king with fire and read Kassapa's mind. And Kassapa still thinks himself holier.
One paragraph adds up the wonders to three thousand five hundred. Its translators say it is clearly a later note by a reader or commentator.
The Islamic perspective
Signs are with God (﷾). The Prophet (ﷺ) is a warner, and the Book is sign enough.
The Qur'an tells the Prophet (ﷺ) to say that the signs are with God (﷾). And it asks whether the Book is not enough.
The Qur'an says that when people saw the moon split as a sign, they turned away and called it magic.