Bilam is presented to us as a total contradiction. He is described in the Torah as "Knowing the mind of G-d", and we are told in the Midrash (Bamidbar Rabba 14; 20) that his level of prophecy surpassed even that of Moshe. Yet his personal habits and character traits were the most despicable that we can imagine. The Mishna (Ethics of the Fathers 5; 19) states: "anyone who has the following traits is amongst the students of Bilam, an evil eye, a haughty mind and a proud spirit." Furthermore, the Talmud (Avoda Zara 4b) derives from the donkey's conversation with Bilam that he used to have sexual relations with it. How could someone simultaneously be on such a high level, and still remain such a base human being?
Rashi comments (22; 5): If you will ask, why did G-d rest His holy spirit on such a wicked non-Jew? In order that the nations of the world should not be able to claim, 'If we would have had prophets we would have repented our wicked ways. Therefore G-d gave them prophets who led them to perform even worse sins'.
Essentially Rashi is saying that Bilam did not deserve to become a prophet solely through his own merit. G-d spoke with him because he was a representative of the nations, not because he was worthy of it. This is why when G-d spoke to Bilam the Torah uses the word "Vayikar", "He happened upon", rather than the way G-d spoke to Moshe "Vayikra", "He called". This shows G-d's 'displeasure' at having to speak to Bilam. Nevertheless, how could someone on such a high level, after having spoken to G-d, remain with such low moral conduct?
A similar question can be asked about the experience that the Children of Israel had when they crossed the Reed Sea. The Mechilta (15; 2) says that even a maid servant saw more (experienced a higher level of prophecy) at the sea than the prophet Yechezkel saw (in his vision of G-d's Holy Chariot). Yet the Jews who crossed the sea remained who they were, whereas Yechezkel merited to be one of the 48 prophets of Israel. How could the Children of Israel remain on the same spiritual level that they had been on, despite witnessing this prophetic experience?
Rav Chaim Shmuelevitz writes that this is a fundamental of mussar (ethics and character building). If a person does not internalise what they experience through their own hard work at self perfection, they will not change who they really are. Knowledge which remains purely intellectual will ultimately have no effect on the way that a person acts. Because Bilam received his prophecy as a gift without having to work for it, and because having received that gift he made no effort to elevate himself to a spiritual level where he would be worthy of prophecy, it had no effect on his personal lifestyle. Bilam saw no contradiction in behaving in a way that was not in keeping with his status as prophet to the nations. Similarly the Children of Israel were not affected by the prophecy they perceived because they were as yet unable to attain for themselves the level where they could deserve prophecy. Only after seven weeks, when they stood at Mount Sinai, were they able to hear G-d speak and internalise that experience. Because they strove to perfect themselves during the Omer period, en route from Egypt to Sinai, that prophecy did change the national consciousness.