“For to a man that is good before him, he gives wisdom and knowledge and jubilation. But, to the sinner he gives the obligation to harvest and to gather to give to the one who is good before God — this is also vanity and exasperates the spirit.”
Sometimes, when we read passages like this, we walk away scratching our heads. We look around the world and see that the wicked prosper and the righteous often under the boot of those who have power in society. We find the church also, often being battered about by the whims of fallen society and we wonder how is it that Solomon can write that the wicked find themselves in failure and having to serve those who are righteous.
A big part of the answer is that Solomon once again is looking at eternal things. In the end, no matter the power the wicked develop in this life, it will fall by the wayside and they will enter judgment. Yet, there is another aspect to the question, which is that Solomon is most commonly writing here about general normative principles, much like you find in the book of Proverbs. And so, there is a principle at work…do the wicked always end up serving the righteous on earth? No. But, in the grand scheme of things, when one looks at the events of all of history, you will often find the norm is that God causes failure in the works of the wicked and raises up those who serve him.
Of course, there is truly none “good” but God…which means that the ultimate model of this is found in Christ. And though the wicked put him to death, he raised from the dead and one day all of mankind (even the wicked) will bow at his feet and proclaim Him to be Lord to the glory of the Father (Philippians 2:9-11). And, in this case, Solomon’s final phrase does not apply to all man, but to the exasperation that the wicked feel when they are laid low before the righteous. Indeed, all of their works will be brought into total frustration.