Just noticed this in the related questions list. Aside from the DM's usual ability to always invent new things, there are a few instances of this specific thing in the canon, including some in D&D 5th edition.
Baldur's Gate: Descent into Avernus has a chapter, "Appendix A: Diabolical Deals", which describes deals with devils in particular. Devils want to acquire souls (which in the long term are processed into more devils), and will offer various specific rewards, such as loyal service for a time, treasure, magic items, etc.
The D&D 3.5 sourcebook Fiendish Codex II: Tyrants of the Nine Hells also describes Faustian pacts, which is essentially the same thing under a different name (probably to avoid confusion with warlock "pact" which has specific meaning in 5e). You have the Pact Certain, where the individual willingly pledges their soul for a reward, and the Pact Insidious, where the contract is more subtle and creates a slippery slope to lead the contractee into evil. Possible rewards include things like feats, spell slots, ability score increases, skill increases, gold, or XP.
The D&D 3.0 Book of Vile Darkness had a related set of sacrifice rules, where characters could gain various magical rewards, or gold and XP toward magic item crafting, in exchange for elaborate ritual sacrifice of humanoids.
There's an NPC in the AD&D World of Greyhawk sourcebook Ivid the Undying named Karoolck who made a specific pact with an archdevil, such that he would live 333 years without aging, and return to life if killed during that time (up to nine times).