2 Then follows, “Give thanks to the God of gods, for His mercy endures for ever”. “Give thanks to the Lord of lords, for His mercy endures for ever”. We may well enquire, Who are these gods and lords, of whom He who is the true God is God and Lord? And we find written in another Psalm, that even men are called gods. The Lord even takes note of this testimony in the Gospel, saying, “Is it not written in your Law, I have said, You are gods?”...It is not therefore because they are all good, but because “the word of God came to them,” that they were called gods. For were it because they are all good, He would not thus distinguish between them. He says, “He judges between the gods.” Then follows, “How long do ye judge iniquity!” and the rest, which He says certainly not to all, but to some, because He says it in distinguishing, and yet He distinguishes between the gods.
Source: The Enarrations, or Expositions, on the Psalms (New Advent)