What is "Tov Lefanav"?
Rashi: It is [good 1 ] in front of Hashem; verse 24 mentioned "mi'Yad Elokim Hi."
Rashbam: It is someone like myself.
Metzudas David: His deeds are pleasing in front of Him.
Why does it say that Hashem gave to him Chachmah, Da'as and Simchah?
Rashi: He gave a heart to engage in Torah and Mitzvos, and rejoice in his portion with food, drink and clean clothing.
Ibn Ezra #1: To one who is good in front of Him, He does not give (influence) him to toil. Rather, He gave to him Chachmah, Da'as and Simchah in money of someone else who toiled for it - "Yachin v'Tzadik Yilbash" (Iyov 27:17).
Ibn Ezra #2 He rejoices in his portion, whether it is big or small.
Rashbam: He gave to Me a Mazal to gather money for my need and benefit 1 .
Rid: He has Da'as to rejoice in his toil.
Seforno: He has Da'as in investigation and in deed. Simchah is in Kinyanim, like Avraham had (Bereishis 13:2).
Metzudas David: It is Chachmah to do Tzedakah and Chesed in his lifetime, and Simchah to eat and drink as his Nefesh desires.
The Torah warns a king not to gather too much money, but does not give a reason. Shlomo imposed a heavy tax on Yisrael for the needs of his workers ('Rashi' Divrei ha'Yamim II, 10:4), horses (Ralbag Melachim I, 12:4) and wives. He made silver and gold in Yerushalayim like stones (Divrei ha'Yamim II, 1:15). The Midrash censures him for increasing wives and horses, but not for increasing money (PF).
What is "Inyan"?
Rashi: It is a custom and worry.
Ibn Ezra: An involvement.
Ri Kara: It is a bad involvement for him. He toils and gathers, and does not benefit from it.
Metzudas Tziyon: It is desire.
Does the sinner intend to give to someone good in front of Hashem?!
Rashi: No. Hashem causes the Rasha to want to gather, so Hashem will give it to one who is good in front of Him 1 , e.g. "va'Tasem Esther Es Mordechai Al Beis Haman" (Esther 8:2). Rashbam, Rid - "Yachin [Rasha] v'Tzadik Yilbash" (Iyov 27:17). Seforno - we find regarding Lavan "va'Yatzel Elokim Es Mikneh Avichem va'Yiten Li" (Bereishis 31:9).
Ohr Yechezkel (Darchei ha'Avodah p.231): The entire purpose of a sinner's existence is to serve one who is good in front of Hashem.
Why does it say "Gam Zeh Hevel"?
Rashi: This is one of the Havalim given to people - they toil, and someone else receives.
Rashbam: The sinner toiled for nothing. Therefore, I should eat, drink and rejoice in my toil.
Rid: It is proper that one who toiled consume it, whether he is a Tzadik or Rasha.
Seforno: Efforts for excesses, even without great exertion, is Hevel; the purpose is not important.
Metzudas David: Even though his toil went to a Tzadik, it is Hevel. It would have been better had he himself willingly done Tzedakah and Chesed!
Why does it add "u'Re'us Ru'ach"?
Seforno: This is when he does not attain any purpose.
Metzudas David: The money is taken from him Bal Korcho (against his will).