It resembles the wisdom writings of Proverbs and Ecclesiastes. The writer seems to be trying to convey or impart some life lesson in the form of a song. The lesson is simple: take no part in the actions of those who are wicked. While there is not true gain with them, the counterpart to hanging out with these people is not to hang out with “good” people, but to “delight” in the law of the Lord.
There is an endless flow of life in the law and fruit is bared in connection to law. I am wrestling with the definition of the law…Mosaic, Levitical, just the “top ten,” or the law of love (shema). Maybe it’s a combination of them all.
Being connected to God through His law will produce unseen treasure that lasts forever while the wicked fade quickly.
* you can tell a lot about a person by the friends they keep.