The Torah clearly prohibits all forms of magic, which we might define as the achievement of any supernatural phenomenon.
Yet we find many neviim, most blatantly Eliyahu and Elisha, achieving many supernatural phenomena, including bringing dead people back to life! (Just to note, these things were being done even through the times of he tana'im and amora'im.)
Now, clearly we must assume that the neviim were not violating the Torah, and thus their actions were permitted. Let us call their actions "miracles" to separate them from the "magic" that is prohibited by the Torah.
What is the difference between the "magic" that the Torah prohibited and the "miracles" being practiced by these neviim?
(Note: This question assumes (1) that magic is real (in opposition to Rambam), and that (2) the stories of the neviim (and tana'im and amora'im) are to be taken literally. I am looking for answers that follow these assumptions, not that undermine them.)