Magic simply claims that the right ingredients and/or words create the desire result. According to the claims of magic the interior disposition of the person does not matter and the desired result must occur if the right ingredients and/or words are present.
A miracle comes from God's own free choice to act in a particular way. God is not bound to act in any manner simply because a human person has said or used the right things. In a miracle it is only God who is acting, the human person has not claimed to have conjured up or harnessed any power.
As the Catechism states:
2111 Superstition is the deviation of religious feeling and of the practices this feeling imposes. It can even affect the worship we offer the true God, e.g., when one attributes an importance in some way magical to certain practices otherwise lawful or necessary. To attribute the efficacy of prayers or of sacramental signs to their mere external performance, apart from the interior dispositions that they demand, is to fall into superstition.
2116 All forms of divination are to be rejected: recourse to Satan or demons, conjuring up the dead or other practices falsely supposed to "unveil" the future. Consulting horoscopes, astrology, palm reading, interpretation of omens and lots, the phenomena of clairvoyance, and recourse to mediums all conceal a desire for power over time, history, and, in the last analysis, other human beings, as well as a wish to conciliate hidden powers. They contradict the honor, respect, and loving fear that we owe to God alone.
2117 All practices of magic or sorcery, by which one attempts to tame occult powers, so as to place them at one's service and have a supernatural power over others - even if this were for the sake of restoring their health - are gravely contrary to the virtue of religion. These practices are even more to be condemned when accompanied by the intention of harming someone, or when they have recourse to the intervention of demons. Wearing charms is also reprehensible. Spiritism often implies divination or magical practices; the Church for her part warns the faithful against it. Recourse to so-called traditional cures does not justify either the invocation of evil powers or the exploitation of another's credulity.