Well, Ed, ... while I've been accused of creating things like this before ... this ia actually something I posted at ECN quite some time ago. That thread was packed with pics of some amazing hackwork in an illegal 'apartment' built within an industrial rental / storage facility. The occupant was evicted, and the apartment dismantled.

I will agree that I have yet to see any problem resulting from the proper connection of an NM whip to water heater. At least, any direct problem ... the wall tends to have a large hole where the cord exits, and I often see water damage, drywall breakage, and signs of vermin at that point. Using a box seems to eliminate these issues.

Yet, the use of a box almost always results in the box being too small, and the free wire ends being about an inch long. That's not good, either.