Is there a specific NEC code specifying the distance between water heaters and electrical panels?
This is a VERY misinterpreted section of the code, especially by lay people and home inspectors. Most homeowners and likewise simply think a water heater cannot be near a panel, for what reason I don't know. 

Basically, the panel can be anywhere in the 30" width working space. There is no mention of center of the panel or otherwise. Meaning, the panel can be at the extreme side of the 30" space as long as the space is clear for 30".

Here is a clear graphic from ©Mike Holt: