We investigate the electronic structure of the fullerenes encapsulated inside carbon nanotubes, the so-called nanopeapods, using the first-principles study. The orbital hybridization of LUMO+1 (the state above the lowest unoccupied molecular orbital) of C60, rather than LUMO as previously proposed, with the nanotube states explains the peak at approximately 1 eV in recent scanning-tunneling-spectroscopy (STS) data. For the endohedral metallofullerenes nested in the strained nanotube, the charge transfer shifts the relative energy levels of the different states and produces a spatial modulation of the energy gap in agreement with another STS experiment.