Another interpretation of (Numbers 23:7) "From Aram": I was with the high one (ram) of the upper realms, and Balak brought me down from my glory. The matter is comparable to one who was walking with the king. When he saw robbers, he left the king and went strolling with the robbers. When he came back to walk with the king, the king said to him: "Go with the one you strolled with, for it is impossible for you to walk with me any longer." So too Balaam had been bound to the Holy Spirit; when he joined himself with Balak, the Holy Spirit departed from him, and he reverted to being a diviner as he had been at first, as it is stated (Joshua 13:22), "And Balaam [ben Beor] the diviner." Therefore he cried out: "I was high (ram), and Balak brought me down."
Why Balaam Lost the Holy Spirit and Fell to Mere Divination
Midrash Tanchuma Buber, Balak 17:3
ד"א מן ארם עם רם של מעלן הייתי, והורידני בלק מן כבודי. משל למי שמהלך עם המלך, ראה ליסטין, הניח את המלך ומטייל עם הליסטין, כשחזר עם המלך, אמר לך עם מי שטיילת עמו, שאי אפשר לך שתלך עמי עוד, כך בלעם נזקק לרוח הקודש, כשנזדווג עם בלק נסתלקה ממנו רוח הקודש, וחזר להיות קוסם כבתחלה, שנאמר ואת בלעם [בן בעור] הקוסם (יהושע יג כב), לכך צווח רם הייתי והורידני בלק.