It pays to be friends with LeBron James.

It pays to share his agent, too.

Not that Tristan Thompson is getting $82 million just for that. LeBron has a lot of friends who aren't getting $82 million of Dan Gilbert's money.

Nonetheless, Thompson agreeing to a five-year deal just days before the season opener after months of haggling and weeks of holding out is the latest example of the LeBron Effect.

LeBron usually gets what he wants, and in this case, he really wanted Thompson to be on his team this season. That was always going to happen -- unless Thompson and agent Rich Paul were foolish enough to have him sit out the entire season without getting paid and then wrestle with the intricacies of restricted free agency again next summer. Of course, they weren't.

Thompson's return to Team LeBron was only going to be a matter of price.

Thompson wanted a max deal totaling $94 million. The Cavs weren't willing to go that high. Much to Thompson's chagrin, not a single team stepped forward with a max offer sheet, which would've made everyone except Gilbert happy. Thompson would've gotten his max, LeBron would've gotten his teammate back, and Paul would've gotten a bigger commission. 

It didn't unfold this way simply because Thompson is worth more to the Cavaliers than he'd be worth to any team that might've contemplated extending him an offer sheet.

"Big difference between what he wants and what he's worth," one NBA source said as the saga unfolded.

Thompson's key skills -- pick-and-roll defense and offensive rebounding -- are incredibly valuable to a championship-contending team that has multiple players who can score in multiple ways. He became even more valuable because James, around whom the city of Cleveland's championship hopes are built, wanted and needed him in the fold -- and was quite vocal about it.

When the Cavs got LeBron back from Miami last summer, their entire approach and financial posture changed. The massive luxury tax rates that Gilbert himself had pushed so hard for during the lockout became mere speed bumps on the way to fortifying the roster around LeBron.

Adding Thompson to the books has pushed the Cavs' payroll past $100 million, and their luxury-tax obligations potentially into the $170 million range. That will represent the second-highest combined payroll and tax payouts in NBA history, after Mikhail Prokhorov's Brooklyn Nets, who doled out $197 million in 2013-14.

Would Thompson have been worth all that trouble (and money) to, say, the Portland Trail Blazers? Not by a long shot. But given the stakes for the Cavs in this second coming of the LeBron era, he's worth it to them.

Once Thompson allowed the Cavs' qualifying offer to expire, a compromise was the only sensible solution. And the truth was, the Cavs didn't want Thompson to play out the season on a one-year, $6.8 million deal, either. The threat of Thompson leaving as a free agent next season in that case was credible, given the astronomical spike in the salary cap flooding the market with money for a sparse list of free agents. Thompson would've gotten paid more a year later, but he would've been risking injury. While the Cavs would've saved millions in luxury tax this season, losing a 24-year-old, 6-9 forward for nothing was the least palatable of all options for Cleveland.

So in the end, common sense and the unique NBA math of what a given player is worth to his team vs. what he might be worth to others carried the day. Plus, only days before the Cavs tip off the season in Chicago against the Bulls, LeBron James is happy. And really, who can put a price on that? 

Tristan Thompson is back with the Cavs.
Tristan Thompson is back with the Cavs. (USATSI)