I believe Solomon was more greedy than foolish with his wisdom. He wrote in Ecclesiastes that he had the most of everything from possessions, women, things most humans desire, etc and in the end they really amounted to nothing as far as value to getting to Heaven. So, he called it foolishness.