I said most of what I wanted to say when I wrote about Halak and Price a month and a half ago. The difference in value between the two goalies is very small, while perception of their abilities will never be further apart. With Halak's contract up, it was time to sell - I imagine he'll want quite the long-term deal, and it'll be hard for St. Louis (or anyone else) to wring a lot of surplus value out of him. Over the next three years, Halak will probably be underpaid by at most $10M, but beyond that he'll be worth at most what he gets paid. At worst, if he's injured or ineffective, he's a multi-year sinkhole.
Montreal's return on the deal might not seem that impressive, but a #13 pick like Lars Eller is worth about $3M (of future value) the day he's drafted. By the time it's apparent he can play in the NHL, he's worth $5M, with some upside. Overall, this is an asymmetric deal:
That's a bit simplistic, but it's essentially what's going on here. In the worst case for St. Louis, they sign Halak to a big contract and he's ineffective and needs to be stashed in the minors, and Eller turns into an OK player. In the worst-case for Montreal, they lose out on Halak's $10M in surplus value over the next three years and Eller never plays in the NHL. If you're not convinced Halak's as good as the contract his agent is demanding, you make this deal. Montreal has simply limited its downside exposure to his failure.
On another note: Denmark will soon be an international hockey power!