Many people believed certain Paritta/Sutta have certain magical power, for example Bojjhanga Sutta for curing illness
I think that if you tell a sutta like the Gilana Sutta to someone whose body is very ill, that can help them, especially when ('right speech') they want to, when they are ready to hear the dhamma from you (which we can assume Kassapa wanted to, was ready to hear from the Buddha):
"Well Kassapa, how is it with you? Are you bearing up, are you
enduring (your suffering)? Do your pains decrease or increase? Are
there signs of your pains decreasing and not of increasing?"
"No, Ven. Sir, I am not bearing up, I am not enduring, the pain is
very great. There is a sign not of pains decreasing but of their
increasing."
"Kassapa, these seven factors of enlightenment are well expounded by
me and are cultivated and fully developed by me. They conduce to
perfect understanding, to full realization (of the four Noble Truths)
and to Nibbana. What are the seven?
i. "Mindfulness, the factor of enlightenment, Kassapa, is well expounded by me, and is cultivated and fully developed by me. It conduces to perfect understanding, to full realization and to Nibbana.
ii. "Investigation of the Dhamma, the factor of enlightenment, Kassapa, is (etc.)
Perhaps this can help them to feel better, to "bear up", to endure.
It might even (temporarily) help to cure their illness. Or it might not. I don't think we should expect it to cure their physical illness for ever: because, "all compound things are subject to decay."
The purpose of Buddhism is to help people even though, even when there is illness, there is death.
What do you think about this?
I this that it is possible for a person who is living and who is dying to understand, to realize, to cultivate the seven factors of enlightenment: to be mindful, to investigate the Dhamma, to persevere, etc.
I even think that can have a 'magical' effect on people: i.e. when they live and when they die they might feel equanimity and kindness and so on, instead of feeling anger and suffering and ignorance and so on.
But the reason why it happens isn't 'magic' it happens for a reason: the reason why it happens is right view, right intention, etc.
Unfortunately, the belief that a ritual has a magical power might be a "fetter", if I've understood that right. See for example Three fetters; or this description of Five lower fetters which includes,
Sīlabbata-parāmāsa: attachment to moral precepts and religious practices. Attachment to form and ceremony. The mistaken understanding that one will be purified and liberated merely by the act of keeping moral precepts, rules, traditions, and practices. The belief that these rules and practices are sacred in themselves. One follows them with the desire for reward or acquisition. Missing the true purpose of moral precepts and religious observances, one ends up astray or in an extreme form of practice (say of practising extreme asceticism—tapa), not on the Noble Path.
Fortunately however; although death is real and suffering exists; even so the dhamma, hearing the dhamma and reciting the dhamma can be helpful, can help to liberate people from suffering.