The idea is that we are not our own. If you read that in light of:
Consider your own calling, brothers. Not many of you were wise by
human standards, not many were powerful, not many were of noble birth.
Rather, God chose the foolish of the world to shame the wise, and
God chose the weak of the world to shame the strong, and God chose
the lowly and despised of the world, those who count for nothing, to
reduce to nothing those who are something, so that no human being
might boast before God.
1 Cor 26-29
There's another reason why no one should boast.
Eph 2:8-9 is more to admonish Pharisees who thought they were saved by adherence to the law and 1 Cor 26-29 is to admonish the rich and powerful who thought they were above the law. Both use the same language and ought to be read in the same context, they can't really mean two different things or have different weight.
Indulgences are just a way of understanding in a human way how our actions can reduce our temporal punishment in purgatory, or be applied to others to reduce their punishment. If we need to pay to the last penny, then we need a method of payment that is possible for human beings to understand.
One thing we can agree on though, it is not necessary for salvation to receive indulgences.
Selling indulgences is just plain old Simony, which is not something that should have ever been going on, although it clearly did.