For players, a signing bonus is always better than base salary because it is paid all at the same time, before the season starts. For one, this means that the player can then invest that money and have an entire year of growth in the market. Furthermore, only salary has escrow withdrawn. As a result, players are saving money by getting paid in bonuses.
However, these bonuses have no affect on the salary cap hit for these teams, even if a player is traded. The cap hit is determined by the total value of the contract, signing bonuses included, divided by the number of years. If a team trades a player after already paying him his signing bonus, all that means is that the team he is traded to will not owe the player said bonus, otherwise, they would.
Teams like the Maple Leafs can afford to hand out massive signing bonuses to their star players like this, much to the chagrin of the rest of the league. Not every team in the league has pockets as deep as the Leafs.