Two dimensional electron gases (2DEGs) at surfaces and interfaces of semiconductors are described straightforwardly with a 1D self-consistent Poisson-Schr{o}dinger scheme. However, their band energies have not been modeled correctly in this way. Using angle-resolved photoelectron spectroscopy we study the band structures of 2DEGs formed at sulfur-passivated surfaces of InAs(001) as a model system. Electronic properties of these surfaces are tuned by changing the S coverage, while keeping a high-quality interface, free of defects and with a constant doping density. In contrast to earlier studies we show that the Poisson-Schr{o}dinger scheme predicts the 2DEG bands energies correctly but it is indispensable to take into account the existence of the physical surface. The surface substantially influences the band energies beyond simple electrostatics, by setting nontrivial boundary conditions for 2DEG wavefunctions.