THey had cap space.
When teams have cap room, when they are below the cap, it's possible renegotiate existing contracts - give raises till the salary cap limit. This never happens because nobody will give players unnecessary raises.
After the trade, OKC was about $2 millions under the cap.
They raised Perkins salary this season. From about $4.5 millions to $6.5 millions.
So the starting salary for the 4 years extension allowed by the CBA became significantly higher. Factoring the raises, it means that OKC was able to offer him about $13 millions more than Boston.
Smart move.