The Rambam writes [On Idolatry, 2:11-12]:
A person bitten by a scorpion or serpent may whisper a charm over the wound even on the Sabbath, in order to settle his mind and to strengthen his heart. The thing is of no avail whatsoever, but, since he is in danger, he is permitted to do it, so he won't feel troubled.
But then he immediately adds:
Those who whisper upon a wound a charm, consisting of verses from the Torah, or who read such verses over a child to save it from fear, or who place beside an infant a Torah scroll or tefillin to make him sleep, are not only guilty of superstition, but are amongst those who deny the Torah. They treat the words of the Torah as mere bodily medicine, whereas they are spiritual medicine.
I remember the practice, back in Egypt, of placing lumps of sugar in the chamber containing the Torah scrolls, in the synagogue, then retrieving them a day later and putting them in a cup of tea given to a sick person -- all with rabbinic permission. Does this practice fall under the Rambam's harsh condemnation, or under his earlier allowance for people's superstitions?