If the user agreed and acknowledged that upon his death his family would not be able to have access to his account...
The users of free e-mail accounts often can be too young to even think of the possibility of death while still having that account, some of them being minor, some of them young adults, college students, etc., much less of how they want their their estate to be handled upon their death. Most of them didn't thoroughly read the agreement, and those who did often made fun of it. If, at least, they had to fill out a short separate document on how they want their account to be handled upon their deaths, then maybe - only maybe - they would at least think of it for a second.
Again, some may not want to share a password with the family while alive, but probably wouldn't mind to do this after death. Just most people, especially young, didn't even think yet of writing a will and sharing an e-mail password in it.
But think of a different scenario (and cases similar to this did happen). A minor girl (or even a young adult) has an e-mail account, then disappears. Would her account be opened in order to find some clues (she still may be alive)? If she, however, found dead, having previously checked that she doesn't want her account to be opened upon her death, but it is necessary in order to find the murderer, would it be opened? I guess it would, upon police request or something alike.
So Yahoo's blanket CYA clause just doesn't do it.
This is not to say that an individual doesn't have a right to privacy. Just the rules should be more refined and flexible than that.