When my elementary-school teacher read us the myth of Pandora’s Box, the idea that hope was still in the box after all the evil things flew out to plague humanity was presented as a good thing - the one actual gift in the Trojan Horse that was Pandora and her box. How could hope be bad, after all? Hope keeps you going through the hard times. Hope is a gift in our culture.
But then why was it in a box of evil things? Pandora and her box full of death and plague were sent to remind humanity that yes, they sure did still need Zeus, even if Prometheus had stolen fire for them. This was revenge, and Zeus was not one to pull his punches in the revenge department.
Magnus also left the spell on the Werther Box as a form of revenge - the Men of Letters thought they didn’t need him. Ha. He would show them - but he tipped his hand, and so they didn’t open the box, and all the evil remained inside until a curious girl took a peek behind the door and let it out. The thing Sam and Dean found when they opened the door all the way - symbolizing Hope - was Nadya’s codex.
For Sam, that book is Hope, a blessing, a gift to rejoice in - the one chance he thinks he has at a cure for his brother, even at the price of cooperating with Rowena on black-hole-dark magic. For Dean, the book may be another aspect of Hope: the false promise that distracts him from getting through his day-to-day existence. He’s already rejected Hope. He’ll obviously accept a cure if one were to present itself (he was initially excited and optimistic about the Book of the Damned), but he’s made the decision to assume there isn’t one, or at least not one he’s willing to pay the price for, and figure out how to go forward with the Mark still on him for the longest possible time.
Who’s likely to be right? The book itself wasn’t part of Magnus’s revenge plan, per se, even if Hope might have been part of Zeus’s. But he recognized it as something so dangerous that it needed to be protected behind wards with a 98% lethality rate. He saw keeping it locked up as worth the lives of good men… and if Magnus thinks something is too dangerous to ever see the light of day again, it was probably not a good idea to let it out of the box.