http://www.cbafaq.com/salarycap.htm#Q64 If another team signs a player who has cleared waivers, the player's original team is allowed to reduce the amount of money it still owes the player (and lower their team salary) by a commensurate amount. This is called the right of set-off. This is true if the player signs with any professional team -- it does not have to be an NBA team. The amount the original team gets to set off is limited to one-half the difference between the player's new salary and the minimum salary for a one-year veteran (if the player is a rookie, then the rookie minimum is used instead).
For example, suppose a fifth-year player is waived with one guaranteed season remaining on his contract for $5 million. If this player signs a $1 million contract with another team for the 2011-12 season, his original team gets to set off $1 million minus $762,195 (the minimum salary for a one-year veteran in 2011-12), divided by two, or $118,902. The team is still responsible for paying $4,881,098 of the original $5 million. Note that between his prior team and new team the player will earn a combined $5,881,098, which was more than he earned prior to being waived.
Teams and players may negotiate a waiver of the team's set-off rights. Typically this is done when a contract is altered as part of a buyout (see question number 65), but not at other times.