Chasam Sofer (Orech Chaim 1:208): And this that you have written a number of times concerning the issue of wisdom and prophecy and Azniel ben Kenaz who restored the lost Halacha by pilpul… You correctly explain that which the Raavad said that there was ruach hakodesh in his beis hamedrash and similar such expressions does not mean ruach hakodesh in the sense that Dovid HaMelech had. Rather it means the spirit of Gd for those who engage in Torah for pure motivations who merit to ascertain the truth even if according to the nature of their wisdom and intelligence they should be incapable of comprehending it properly. Nevertheless, Gd in His mercy gives extra inspiration of wisdom for a limited time. In this manner Azniel ben Kenaz merited to ascertain the truth through pilpul, kal v’chomer and gezera shaveh [Temurah 16a] that which his natural intelligence was incapable of doing. This is similar to what it says in Bava Basra 12a that even though prophecy was taken from the prophets but not from the sages. However, your understanding of this gemora to be that wisdom was not taken from the sages is incorrect. Rather it is that prophecy was not taken from the sages. In other words, that type of prophecy which is attainable through the wisdom of one who studies Torah for pure motivation merits many things [Avos 6:1] with his intellect and his wisdom even though he doesn’t have the natural ability for it. The gemora wants to prove this from the common fact that a talmid chachom comprehends something on his own which in fact is according to the understanding of Rabbi Akiva. We know that this person’s level is not up to Rabbi Akiva’s heels. This proves that it happened by the prophetic ability we mentioned. In addition, we also find that he says things which in fact are Halacha L’Moshe m’Sinai. The gemora rejects this proof by saying that perhaps this occurs by chance like a blind person groping through a window. However, the gemora concludes that it is not by chance since he gives justifications for his views and thus it is like a prophetic form of wisdom. This idea can explain the gemora in Megila (16a): “Whoever says wisdom even if he not Jewish is called a wise man.” The obvious question is why shouldn’t he be called a wise man? Don’t we in fact even say a beracha on the wise men of the nonJews “who gives of His wisdom to human beings” (Berachos 58a)? The answer is that without this gemora we would have mistakenly thought that Divinely inspired wisdom only comes to Jews while if a nonJew said something brilliant that seems to transcend his intellectual capabilities we would have thought it was just blind chance….