Bilam was the grandson of Lavan, some say the son of Lavan. And while Yaakov was in Lavan's house Bilam learned from him. Yaakov would grow from strength to strength in his service of HaShem. Bilam would grow from strength to strength in his service of the unholy klippoth. (Noam Elimelech פרשת יתרו)
We can't stop people from abusing their powers for evil, what we see later with Bilam is that obviously even their power comes from HaShem and so they can't do anything against His Will.