There's essentially three ways of getting out of this contract: trade, buyout, or LTIR.
A buyout and LTIR both have cap implications that will further complicate the Leafs already screwed up cap situation.
The problem with the buyout is that while it saves significant money this year,, it comes with a $2M cap hit in 2024/2025.
That's the same year that Matthews, Nylander, and Liljegren all have their extensions and raises kick in.
They are going to be soooo tight to the cap that year that $2M will absolutely be a hindrance.
The problem with LTIR is that they can't accrue unused cap space and use it as leverage at the deadline. They would have to trade dollar for dollar to accomodate the incoming player(s). So they will be limited in pursuing rentals at deadline to third line chumps and bottom of the roster grinders again, unless they pay a third party to retain salary again. But if they did that, they may as well just go with option three: dump him.
I'm not a hockey expert. Just an armchair GM. But I wouldn't be surprised if the Leafs attach a good prospect like Robertson and/or the 1st they got in return for trading Sandin, and just dump Murray on a tanking team.
There would be no cap implications that way.