As has been pointed out, an extra mil for Hamilton effects the team's cap structure a few years down the line when Aho, Teravainen, Pesce and Slavin are up in a 2 year span. A 1 year deal for Kotkaniemi does not.
The number is not that notable. Carolina has short-term cap space. Commit beyond this year and there's a headache coming with a big raise coming for Necas, Top 4 money for DeAngelo/Bear (whoever steps up to play Top 4 minutes) or someone that can play that role if neither grabs it, and a bump for Trocheck, if retained. Overpaying for 1 year is no big deal.
The real question is if this the best way to use the assets? That's up for debate. I'm guessing the Canes were looking at a forward market that dried up real quick and had a bearish view of what would be available in-season. They landed on Kotkaniemi and when Montreal wouldn't trade him, went down this route.