Via Kurt Badenhausen/Forbes

NBA commissioner David Stern was vilified by fans and players for his role in the lockout that erased 20% of last season. But Stern works for the owners, and it appears the commish, who is retiring in 12 months after 30 years in charge, is going out on top. Stern is worth every penny of his salary, estimated to approach $20 million.

The NBA locked out its players in the hopes of constraining their salaries, boosting profitability and raising franchise values. A year later, owners should be ecstatic with the results.

The average NBA team is worth $509 million, a 30% increase over last year. The increase is due to higher revenue from television, new and renovated arenas, and the NBA’s new collective-bargaining agreement, which reduced player costs from 57% of revenues to roughly 50%. The labor deal also increased the amount of money high-revenue teams provide low-revenue teams.

The New York Knicks are the league’s most valuable team, worth $1.1 billion, reclaiming the crown from the Los Angeles Lakers, who topped last year’s list. The Knicks‘ value rose 41%, mainly due to a $980 million renovation of Madison Square Garden that is expected to be completed this summer. The makeover resulted in an NBA-leading $243 million in revenue last season. The Knicks‘ operating income of $83 million was the highest in the league for a third straight year. Another plus: better play. In 2012, the Knicks won a playoff game for the first time since 2001.

Knicks fans have re-embraced the franchise after a miserable decade. Ratings for Knicks games more than doubled last year on MSG thanks to Linsanity and the 2012 playoff appearance. They were up  a further 74% this season as of January. Fans snapped up Knicks gear – the team’s merchandise was the second-bestselling in the NBA last season. Knicks merchandise was the NBA’s top seller between April and November after point guard Jeremy Lin had played his last game for the team.

Full List: The NBA’s Most Valuable Teams

Complete Coverage: The Business of Basketball

The Lakers rank No. 2, worth $1 billion, up 11% from last year. The Lakers and Knicks are the first NBA teams to be valued at 10-figures. The Lakers‘ revenue will surge this season with the start of their new 20-year, $3.6 billion television deal withTime Warner Cable. Two new regional sports networks, Time Warner Cable Sportsnet and Time Warner Cable Deportes, got off to fast starts, with Time Warner striking carriage deals before the season began with DirecTV, Cox, Verizon, AT&T and Charter at monthly rates approaching $4 per cable subscriber.

The 16-time NBA champions had the NBA’s highest payroll for a third straight year last season, triggering a $12.6 million luxury tax bill. (L.A. paid $55 million over the past three years.) The NBA’s new CBA includes a more punitive luxury tax that will result in dramatically higher tax bills starting next season for the Lakers. The new CBA also triples the amount of revenue sharing to $200 million that gets transferred to low revenue teams from the financial elite. The Lakers are expected to take the biggest financial hit from the new revenue-sharing plan when it is fully implemented in 2013-14.

The outlook for the NBA is strong, with stars like LeBron James and Kevin Durant in their prime and formerly weak franchises revitalized in the big markets of New York (Nets) and Los Angeles (Clippers). The NBA expects league-wide revenues to top $5 billion this year. The league’s $930 million-a-year deal with ESPN and TNT runs through the 2015-16 season and should more than double under the contract.

The value of the newly christened Brooklyn Nets is up 48% to $530 million, ranking the club ninth overall. The move from New Jersey to the $1 billion Barclays Center has transformed the team from one of the league’s financial laggards to one of its elite, with luxurious floor level suites that rent for $550,000 a year. Barclays is adding the NHL’s Islanders as a tenant starting in 2015, which will help offset the arena’s operating expenses.

The bright outlook and new CBA is not only raising the values of big-market teams, but the small fry as well. A group headed by Robert Pera, founder of Ubiquiti Networks, bought the Memphis Grizzlies from Michael Heisley for $377 million in October. The Grizzlies lost a league-high $25 million last year due to a payroll that does not fit their small-market status and the team has lost money for 10 straight years by our count, but its value has still soared. Heisley bought the team in 2000 for $160 million and pocketed much of the arena’s naming rights money from FedEx upfront.

Tom Benson, who has owned the NFL’s New Orleans Saints since 1985, bought the Hornets from the NBA in April for $340 million. Benson also extended the team’s lease at the New Orleans Arena through the 2024 season. The NBA, which bought the Hornets from George Shinn in a seller-financed deal in December 2010 for $310 million, broke even on the sale to Benson. As part of that agreement, the state of Louisiana, which owns the arena, will provide $50 million of upgrades for such things as additional premium seating that will generate more revenue for Benson.

The latest team sale involves the Sacramento Kings. The Maloof family has agreed to sell the team to Microsoft CEO Steve Ballmer and hedge fund manager Chris Hansen for $525 million (plus a relocation fee expected to be at least $50 million that will be paid to the NBA). The Kings have been trying for years to replace their antiquated arena to no avail and flirted with a move to Anaheim’s Honda Center in 2011. If the deal goes through, Ballmer and Hansen will move the Kings to Seattle, where they will play in KeyArena (the home of the SuperSonics prior to the team’s move to Oklahoma) for two seasons and then move into a new $490 million arena.

The average operating income (earnings before interest, taxes, depreciation and amortization) for the league’s 30 teams during the lockout-shortened 2011-12 season was $11.9 million, the most since Forbes began tracking the finances of NBA teams in 1998.

The NBA’s record profitability last season was a function of the new CBA and player costs (owners’ biggest expense) being slashed 20% due to the 66-game season. Yet revenues only fell 7% as teams were locked into long-term media and sponsorship deals that in many cases did not require teams to refund any money from lost games.

“Sponsorship contracts almost never include actual rebates,” says Jim Andrews, an exec at sports sponsorship consultancy IEG. “They are much more likely to include ‘make-goods’ such as extending the term of the deal, or providing additional benefits to make up for those lost to games not being played.”

The result was league-wide profits doubled from the previous season. Only eight teams lost money, compared to 15 in the previous season. Many of those still losing money will move into the black once the new revenue-sharing is fully implemented next season.

Full List: The NBA’s Most Valuable Teams

Complete Coverage: The Business of Basketball