The answer would seem to be that magic really worked in those days. I think we all understand that magic does not work today. The question is why did it stop working?
The answer is that to enable free choice Hashem has to create balance in the world. In a world where there is נבואה there needs to be a counterbalancing force, otherwise belief in Hashem would be coerced. Therefore, magic worked and served as teh counterbalance to נבואה.
We find this idea expressed in a number of other places as well.
The Gemara in Shabbos comments that כפה עליהם הר כגיגת by Matan Torah. The obvious question is didn't they say נעשה ונשמע, meaning that they excepted the Torah willingly? The Meshech Chochma answers that the Gemara is meant to be taken allegorically. The revelation when Bnei Yisrael left Egypt, krias yam suf, and matan torah was so great that it was as if Hashem forced them to accept the Torah. The revelation was so great that they could not say no, Hashem's presence in the world and Torah's importance were self understood like the sun is shining. They understood that if they did not accept the Torah the world would be destroyed, not as a threat but as a fact, as reality. In other words, their free choice was taken away by the tremendous revelation.
The Anshei Knesses Hagedola asked Hashem to be mevatel the yetzer hara for avoda zara at the beginning of the second Beis Hamikdash and Hashem agreed. However, as a consequence, נבואה ended as well. נבואה can not exist in the world without a counterbalancing force. Otherwise people will lose their בחירה חפשית.
Likewise, magic cannot exist without a counterbalancing force like נבואה and miracles. Without the counterbalance the pendulum will swing too far away from belief in Hashem. Since we don't have these counterbalancing forces magic can't work today.
This idea also explains how/why Hashem hardened Pharoah's heart. The revelation of the makos took away his free choice, the hardening of his heart restored that balance. Hashem didn't take away his בחירה חפשית by hardening his heart, rather he restored it. By taking the makos out of the equation he gave Pharoah free choice whether to release Bnei Yisrael or not.