We know that internal energy is internal kinetic energy + internal potential energy. For the same mass at the same temperture, the internal kinetic enegy of all states matter remains the same. Intermolecular forces of attraction are found to be the strongest in solids. Therefore in solids the internal potential energy is negative and its magnitude is found to be the highest, whereas in gases the intermolecular forces is found to be negligible. Therefore the internal potential energy of a gas is found to be zero. Therefore, the internal energy of a gas is highest for the same mass at the same temperature.