The truth is somewhere in between.
Many of the miracles originate from songs, singles verses as well as complete stanzas and tales. Through prayers and thorough internalizing with the help of the gods by receiving their blessing it was possible for the miracles to be manifested as "citable" prayers.
We learn this not only in the older parts of the Dark Souls series, but in the latest installment where you meet a blind woman desperately in need of tomes to read you tales from which will then enable you to learn new miracles from her.
Also some of the item descriptions give away the origin of the miracles which happened in fact through prayers but with the help of the gods:
Miracles are fruit of the study of divine tales, a blessing received
from the gods, through acts of prayer.
See this wiki entry for an example of such an item description.
To sum things up, when you are using a miracle you are citing some kind of tale, song or prayer. You will always need a scroll or a tome or something similar to read it from in order to truly internalize the miracle. Although it is not stated anywhere I can imagine that the medium on which the miracle is learned from, must have some divine properties, blessed material or alike. This of course let's enough space for your imagination.