There are two talmidei chachomim - Rav Reuven and Rav Shimon. Rav Reuven is the greater scholar BUT he learned שלא לשמה - to get smicha etc. Rav Shimon is a lesser talmid chochom but his learning was completely pure [we never can be certain what is in a person's heart but let us assume that in this case it is quite clear].
Who deserves more kavod - the greater scholar or the learner with the more pure intentions?