Iblis believes till this day (deceiving himself) that he is correct. Should God stop everyone from calling to incorrect ideas? And magic is allowed from Iblis for many reasons among them, when Iblis disbelieved, he accused the veils of light of deceiving Angels and universe and sarcastically addressed their Lord (while not believing in Him) that he would lead astray all servants except the sincerely devoted to him, and in the expression, he means the sincerely devoted to God are fools. And this is what he deceived himself when he took his "unique" stance that all Angels were fools except himself. Now his unique stance he had has become a norm of Jinn and humans, to become arrogant and follow their own views rather then rely on God's guidance. God took Iblis statement and turned around and said in fact, anyone who follows Iblis will go to one of seven gates of hell, and he will not be able to overcome his sincere worshipers and that in fact is a straight path to God. We can start out as fools, as long as we worship God above all else, and don't equate with God, we will make it back to God, as did Adam (a) after swerving.
God allows freedom for creation. If he forces people not to lead astray, then everyone would forcefully submit. The Magic is part of the abilities of Iblis and other Jinn as well all humans have magical abilities or psychic abilities whether they recognize it or not.
Iblis believes himself to be good, he thinks of Angels and the chosen ones as deceivers or deceived, and thinks he is correct.
Allah (swt) could've jailed him or took away his ability, but again, this would make a lesson, and no would lead anyone astray because God would just take away your abilities or jail you. Then goodness and our relationship to God would be meaningless because there is only one possible outcome and that would be compulsion from God.