Distance requirements for water heater setup are based on safety. As an example, the minimum distance in the ground is intended to prevent fires and explosions if a flammable material is spilled on the ground near the water heater. This condition applies to gasoline components, not electrical ones, because gasoline requires a flame along with a lighting mechanism.
The Uniform Plumbing Code, which establishes standards nationwide, says that the flame or sparking mechanism at a gas water heater must be at least 18 inches away from the ground. This means that an accurate measurement for proper setup is not depending on the distance in the bottom of the water heater into the ground. On the contrary, it’s based on the distance in the pilot or lighting mechanism into the ground. Codes vary by county and city and may be more strict than domestic norms, so check with your regional officials before installation. Moreover, some newer models of gas water heaters have combustion chambers which are completely sealed, eliminating the need for space between the ground and the ignition mechanism. Oftentimes, however, construction codes have not caught up with this new technology and still require a minimum distance to the ground.