If Tulo was still with Toronto and under that contract, retirement would mean him giving up the money.
But Toronto released him from the contract. Essentially the new deal was Toronto agreeing to pay him the same salary to not play for them. Annoying, but it lets him retire and still get the money.
And if he had not been released, I doubt he retires and foregoes the ~20M or whatever it is, so it's a moot point. Too bad they couldn't find some way to get someone to take on the contract.