I don’t like Leo. I think I’ve been pretty clear about that. Also, an indulgence is not used as a means to forgive sins. An indulgence is nothing more than the Church telling a Christian they have done enough penance for a sin God has already forgiven them for. Basically saying, that God will no longer make you suffer any punishment from God while you are still not in heaven for that sin. The binding and loosing you described earlier.
Alms giving is one way of doing penance but Leo let people be misled by the people collecting the alms and those bad people lied and said the indulgence that was earned by their alms would give the alms giver more than it actually did. Leo was not a good fit for the job he had.
Um, no.
So this is rather complicated but here goes. An Indulgence simply put is the forgiveness of Temporal punishment after the guilt has been forgiven. This assumes a retributive system of justice that is not known in scripture. This is partly due to the mistranslation into latin the greek word μετανοέω which we translate (following Erasmus) "repent" (Matt 4:17) the Vulgate translated
poenitentia which means "Do penance". This is closely tied to the doctrine of purgatory which develops along side the idea of indulgences so that over time the performance of penance became a substitute for temporal punishment in purgatory. Which then begs the question of what is purgatory.
Purgatory is an intermediate state where the faithful who are in route to heaven must be cleansed of all the temporal punishment due sin already forgiven and venial or minor sin. The cleansing involves fire not unlike hell. While there's no exact time when the average person will endure the fires of purgatory most medieval sources have it in the tens of thousands of years.
Back to indulgences. As penance came to be considered as a substitute for temporal punishment in purgatory, the path naturally lead to the belief that the prayers and merits of the saints availed to shorten such punishment itself, even for sins which did not require penance. Later, with the relaxation of the penitential discipline, alternative works and alms were permitted instead of the prescribed penances, and the merits of Christ and the saints taken from the "Treasury of Merit" make up the deficiency. And with John Tetzel the alternative penance was simply cold hard cash. And why not? How much would you pay to get Grandma out of 10000 years of purgatory with its almost hellish fires. Which begs another definition.
"Treasury of Merit". is the belief that because Christ and all the saints acquired though good works extra merit to get into to heaven the excess was deposited like funds into the the treasury of merit. Not unlike a bank account, And guess who controls the treasury of merit? You guessed it, the Pope. And how do you get some of this merit? Through an indulgence.
So back again to indulgences. Leo X was broke. The papacy's account was way short of money to build St Peter's Basilica so as luck would have it the new archbishop of Mainz was also looking to pay back some benefactors after having leant money to buy the archbishopric (yes, good old fashioned simony) so they made a deal. The pope would declare a plenary indulgence and in exchange for alms the buyer received a letter that said granny was out of purgatory. Then the Pope and the good archbishop split the proceeds. It was this practice that drew the attention of an augustinian monk named Martin Luther and launched the reformation.
For general indulgences, there is no certain evidence datable before the 11th cent. In the 12th cent., however, the practice of granting indulgences became more common. And they are still granted to this very day though to be fair they are granted under very specific circumstances.