When the NBA and its players union struck a new collective bargaining agreement in 2011, the league gave teams a very valuable contract provision: Each NBA franchise had the opportunity to wipe clean one bad contract from its payroll.

That is, the team would still have to honor the contract in full, but the contract wouldn't count against the team's salary cap. The amnesty provision could be applied only to a contract that had been signed before the ratification of the new CBA.

Today, most of those contracts are expired. According to Real GM, there are only three players in the NBA whose contracts and teams are both eligible to use the amnesty clause: Oklahoma City's Kevin Durant, Memphis' Mike Conley and Atlanta's Al Horford. None of those players have any real chance of being amnestied. Durant and Conley are too good, while Horford's $12 million salary is a good bargain even with the recent slip in his production.

Many teams ultimately opted to use the amnesty provision to exercise minor cap relief by unloading small contracts that were nonetheless an inconvenience. The drawback of the amnesty is that you still have to spend the money even if it doesn't count against the salary cap, and most teams are reluctant to eat millions of dollars to get nothing in return.

Some of the largest amnesties that occurred were the unloading of Brendan Haywood's hulking contract, which cost Dallas a cool $27 million. Over the summer, the Bulls used their amnesty clause on Carlos Boozer, which is costing the team $13.5 million this season.

The Bulls are essentially paying Boozer to play for the Los Angeles Lakers this season, but they're fine with taking that extra expense. While Boozer's performance has dipped dramatically this season, the Bulls used the free cap space to sign a rejuvenated Pau Gasol, and they also brought over Nikola Mirotic from Spain's Real Madrid club. Teams use the amnesty because they wanted to cut their losses and invest their cap space elsewhere.

These amnesty decisions offer a perfect comparison to what's happened with Josh Smith. Earlier this week, Pistons coach Stan Van Gundy informed the forward that he was being waived by the franchise. Smith was brought in two seasons ago as a star free-agent signing for Detroit, but a lot has happened in the time since. The Pistons struggled to convert big free agent spending into on-court success. Last season, they dumped their coach and forced Joe Dumars to step down as the team's GM.

Smith was part of a crowded frontcourt that included promising big men Andre Drummond and Greg Monroe. Given the upside those two offer, Smith was the obvious odd man out: There wasn't enough minutes to spread around to all three, and doing so could have jeopardized the development of the two young bigs. Van Gundy tried to make Smith work, but with Detroit free-falling in the Eastern Conference standings, the Pistons are switching strategy and are now focused on developing young prospects.

From a personnel standpoint, the move makes perfect sense. The financial considerations, though, are a little more complex: Smith has two years left on his contract after this season, and roughly $25 million he's still owed. He isn't eligible for the amnesty provision, so Detroit will have to honor the full sum.

Detroit could have traded Smith to unload the contract and save $25 million, but it would have cost the Pistons other financial assets. Only one team was interested in taking on such a massive contract. Smith is a competent NBA player, but he is a sabermetrics nightmare and is shooting 39 percent from the floor this season -- a terrible figure for a power forward. Only Sacramento was willing to accept him in a trade, and Detroit would have had to sweeten the deal with other assets, including draft picks, just to get Smith off its hands.

The franchise wasn't willing to part with more juicy assets, so it used another nifty clause in the collective bargaining agreement: a "stretch provision," which allows the Pistons to stretch out Smith's salary payments -- and their hit on the team's salary cap -- for a period of up to five years, according to Forbes.

By doing that, Detroit isn't completely hamstrung by Smith's albatross contract. In fact, what Detroit did might have a little genius to it that isn't apparent on the surface.

Smith's contract will cost the team anywhere from $5.1 to $5.4 million per year for the next five years. For the first two years, that's a nice markdown from the $13.5 million the team would have owed him -- savings of a little more than $8 million. Detroit can use that money to be active on the free agent market.

The financial burden does extend for three more years, which would handicap the franchise well into the future except for one thing: After next season, the salary cap is expected to increase significantly. A massive TV contract signed earlier this year will go into effect for the 2016-17 season, and it's estimated that the salary cap will increase from a projected $66 million next season to $90 million the following year, per Detroit Bad Boys.

The extra $5 million in dead money becomes much less of a burden, in other words. Teams will have a huge upshoot in salary to work with, and Smith's contract obligations will represent a smaller share of the cap. When measured in terms of its percentage of cap space, the stretch provision actually saves the Pistons money will offering short-term cap relief.

So that's the good news. The bad news, for the Pistons and the NBA at large, is that stories like this aren't likely to go away. The NBA has done a lot of work to reduce the risk of bad contracts that hamper a team's competitiveness. Most recently, the introduction of shorter contracts -- now four to five years in length, compared to six or seven in previous years -- minimizes the long-term ramifications of poor personnel decisions. The amnesty clause helped out a lot of teams, and the stretch provision gives teams some crucial breathing room.

But the nature of basketball salaries and NBA team-building is inherently risky. Bad contracts may happen in the NFL and Major League Baseball, but franchises in those leagues are working with much larger rosters. It's easy to maneuver around a few bad contracts when you have 54 roster spots to work with. NBA teams, meanwhile, only have 15. And since one single player can make such a difference in a team's competitiveness, clubs are eager to lock down promising talent early -- sometimes before they prove worthy of a large contract.

This happens virtually every offseason. It's not just the big-splash signings like Josh Smith that present risk. There are typically two other ways NBA teams get snared into a bad contract: Restricted free agent signings and rookie contract extensions.

Rookie contract extensions are particularly speculative. When players enter into the last year of their rookie contracts, teams have the chance to offer an extension to those players. The problem is, many of those players are still developing as NBA players. In all too many cases, the season ahead figures to be the year that establishes their ceiling in the NBA. But teams run a risk by allowing those contracts to run out: If those young players dominate in the ensuing season, they will almost certainly command a max contract as restricted free agents, costing much more than an extension might have warranted for the team.

Signing an extension sets teams up to collect on a bargain for years to come, and without letting players see their price inflated on the open market. But if extensions are signed by players that go on to underwhelm in the upcoming season, it's devastating for a team, setting the club up for years of bad contract value.

Teams pursue rookie contract extensions because they believe it's a worthwhile gamble. If you hit with a great player, you have a contributor at a price the open market would never allow. It only takes one team to overpay an NBA player, and it happens all the time. Great players are worth a few duds along the way. The problems arise when teams keeping hitting all the duds and miss the high-value signings.

Restricted free agency functions in a similar way: Incumbent teams have a chance to match any offer their player gets. But this can often lead to small-market teams driving up the price in hopes that the incumbent team won't match. Plenty of bad teams are willing to overpay a decent player just to stir up excitement and elevate their team to a level of respectability.

It's not a move you'll see many title contenders make -- although Dallas arguably did this with Chandler Parsons over the summer -- but it's the nature of the game. In a perfect world, these economic dynamics would encourage league parity. More often, though, restricted free agency spawns dubious contracts for good-but-not-great players, making them the alpha dogs on teams whose ceiling is a middling playoff seed.

This is how the NBA works. There are only a handful of superstars, and it's hard to win a championship without one. At any one point in the life of the NBA, almost half of the teams are probably making trades, signings and other moves in hopes of landing one of those superstars.

But there are also teams like Detroit, who before this year was investing salary into a good roster that had virtually no chance of contending for a championship. Joe Dumars needed to inject the franchise with some excitement to keep his job, and since he didn't have a superstar to land, he brought in Smith and Brandon Jennings to improve the franchise and extend the GM's tenure with the team.

In the end, that didn't work out. Smith was overrated and overpaid, and the rest of the roster was too thin to make the playoffs even in the depleted Eastern Conference. Detroit may have star-caliber youth in Drummond and Monroe, but the prospects of a team built around those budding bigs will be handicapped for years to come by a questionable investment in Josh Smith. For better or for worse, that's life in the NBA. And it's not going to change.

Related Story: 12 Worst NBA Contracts Of 21st Century

Story continues below