ABSTRACT Gas inflow into galaxies should affect the star formation and hence the evolution of galaxies across cosmic time. In this work, we use TNG100 of the IllustrisTNG simulations to understand the role of environment on gas inflow rates in massive galaxies at z ≥ 2. We divide our galaxies (log (M⋆/M⊙) ≥ 10.5) into cluster ($\log \rm {M_{halo}/M_\odot }\ge 13$) and field ($\log \rm {M_{halo}/M_\odot } < 13$) galaxies at z = 2 and further divide into centrals and satellites. We track their gas inflow rates from z = 6 to 2, and find that the total gas inflow rates of satellite galaxies rapidly decline after their infall into cluster haloes as they reach the cluster centre. At z = 2, the gas inflow rate of cluster satellite galaxies is correlated with the cluster-centric radii and not the host halo mass. In contrast, the gas inflow rate in centre is strongly correlated with the host halo mass at z ≥ 2. Our study indicates that between redshifts 6 to 2, the gas that is normally accreted by the satellite galaxies, is redirected to the centre of the cluster halo as inflows to the cluster centrals and forming the intracluster medium. Our analysis suggest that the inequality of gas accretion between massive satellite and central galaxies is responsible for the starvation of cluster satellite galaxies that evolve into the massive quenched cluster galaxies observed at z < 0.5.