Go back to the story of King David in the Old Testament. When he has Uriah killed and takes his wife as his own, then conceives a child with her, what does the prophet Nathan tell him? He tells David that God has forgiven him BUT the child shall surely die. Was he forgiven his sin? Yes. Was there still a price to be paid for that sin, although it was forgiven? Yes.
The common example given to illustrate this point is that of a kid playing baseball and bats the ball right through a neighbor’s window. Being contrite, he goes over and knocks on the door and apologizes (asks for forgiveness). The neighbor forgives him, so the matter of forgiveness is settled. Now there is the matter of replacing the window and burdening that cost. It doesn’t necessarily follow that because the neighbor forgave the child for breaking the window that they would automatically assume the cost of fixing the window too. That might be rightfully put on the child and does not influence forgiveness one way or the other.
Thus when you sin, you can seek and receive forgiveness but that doesn’t necessarily square you with the almighty any more than King David’s admission of his sin and repentance did. You will note Nathan even talks about the consequences of David’s sin - it gave the enemies of Jehovah cause to blaspheme - meaning there were consequences beyond just something between David and God. That’s the same for all our sins; there are always external consequences for the things we do. There is still the temporal punishment to be dealt with. For Catholics, this temporal punishment is dealt with through completing a penance assigned by the priest at the time of confession.
An indulgence only deals with addressing that temporal punishment; it does not in and of itself “forgive sin” or “make up for sins.” If you look at what is required to earn an indulgence, they are most often associated with sacramental confession (i.e. - being in a state of grace first) and other conditions such as attending Mass/receiving the Eucharist, praying for the intentions of the Pope, etc. It isn’t a matter of just showing up and writing a check and you’re done. In fact the giving of alms (money) is but one of many ways to earn an indulgence, and in all of those cases there is much more involved than just money.
In the time of Luther, this giving of alms was emphasized over the other possible ways of earning them. In fact one of the things that set Luther off was that the city/state he lived in did not allow them, but the neighboring ones did. Members of his flock went across the bridge and gave the money, then presented the indulgence to him at their confessions. This kind of sales campaign style peddling of indulgences was wrong, and the way indulgences have been handled since then over the years illustrates that.