- Gray was referencing Ecclesiastes and playfully inverting the conclusion of an important verse.
For with much wisdom comes much sorrow; the more knowledge, the more grief.
Grey's poem is quite famous, as is the phrase "ignorance is bliss" and much has been written on it, but the the core meaning is quite simple.
The more knowledge one has, the greater one's grief, because this knowledge includes the inevitability of death, and that all we are and do and achieve eventually turns to dust.
Shelley referenced this in his Ozymandias, although TS Eliot's allusion in The Waste Land may be the most compact: "I will show you fear in a handful of dust." The reference to dust goes back to the beginning, Genesis 3:19, and provides a basis for Ecclesiastes: "For dust you are and to dust you will return."
Remember that Ecclesiastes begins with "Vanity, vanity, vanity--all is vanity" (Ecclesiastes 1:2) and goes on to explicate this in exhaustive detail.
Yet when I surveyed all that my hands had done and what I had toiled to achieve, everything was meaningless, a chasing after the wind; nothing was gained under the sun.
What makes Gray's turn of phrase so clever is the reversal of King David's conclusion:
Then I turned my thoughts to consider wisdom, and also madness and folly. What more can the king's successor do than what has already been done? I saw that wisdom is better than folly, just as light is better than darkness.
Ecclesiastes 2:12 ff.
Of course, it gets more complicated because King David goes on:
The wise have eyes in their heads, while the fool walks in the darkness; but I came to realize that the same fate overtakes them both.
Gray is saying it is better to "walk in darkness", and be happy, even if that happiness is temporary, than to go through life with full knowledge of mortality and the ultimate vanity of all endeavors.
Where David concludes that even wisdom is ultimately meaningless, Gray calls it folly, and concludes that ignorance is the optimal strategy.