We present an entirely analytic model for a preheated, polytropic intergalactic medium in hydrostatic equilibrium within a NFW dark halo potential in which the evolution of the halo structure between major merger events proceeds inside-out by accretion. This model is used to explain, within a standard ΛCDM cosmogony, the observed X-ray properties of nearby relaxed, non-cooling flow groups and clusters of galaxies. We find that our preferred solution to the equilibrium equations produces scaling relations in excellent agreement with observations, while simultaneously accounting for the typical structural characteristics of the distribution of the diffuse baryons. In the class of preheating models, ours stands out because it offers a unified description of the intrahalo medium for galaxy systems with total masses above ∼ 2 × 10 13 M ⊙ , does not produce baryonic configurations with large isentropic cores, and reproduces faithfully the observed behavior of the gas entropy at large radii. All this is achieved with a moderate level of energy injection of about half a keV, which can be easily accommodated within the limits of the total energy released by the most commonly invoked feedback mechanisms, as well as with a polytropic index of 1.2, consistent with both many observational determinations and predictions from high-resolution gas-dynamical simulations of non-cooling flow clusters. More interestingly, our scheme offers a physical motivation for the adoption of this specific value of the polytropic index, as it is the one that best ensures the conservation after halo virialization of the balance between the total specific energies of the gas and dark matter components for the full range of masses investigated.