Doing the rounds right now is a post from Valve's Steam support, when a user asked about what would happen to their Steam account when they died and it's not great news for anyone hoping to pass on your Steam account.
That said, I'm looking for details for individual games, but odds are, the rules are the same. Yes, you can still do it, but you can on Steam as well and if you're disregarding legality, theres always other options.
Edit 2:
3.3 Your GOG account and GOG content are personal to you and cannot be shared with, sold, gifted or transferred to anyone else.
GOG has always been big on non-DRM and giving you direct access to the installers. They do have a launcher, which likely has similar terms as Steam, but there's no way to enforce the way people use installers.
So it's more similar to physical media--there's still legislation, but I don't believe "passing on" a game would be any more illegal than passing on a physical disk.
And GOG has always been in favor of this model, to my knowledge.
You can literally just download copies of all your games and give them the installers, even if it's in the TOS, there's nothing stopping you from bequeathing them via a drive practically speaking.
When I die, I am absolutely making sure someone I like gets password access to my accounts on various services. Don't care if it's against TOS of various services. That's their problem, not mine.
This is a reply by a lowly employee completing a support ticket. Just because the circumstances are different, they won't do much asking around and treat it the same as someone asking "can I give my account to my brother".
Both of which is equally horrible. Yes, you should be able to give what you bought to anyone, including your brother and it should automatically transfer to whoever you (or your country's laws) think should get it when you die.