We present a framework for characterizing the large-scale movement of baryons relative to dark matter in cosmological simulations, requiring only the initial conditions and final state of the simulation. This is performed using the spread metric that quantifies the distance in the final conditions between initially neighbouring particles, and by analysing the baryonic content of final haloes relative to that of the initial Lagrangian regions (LRs) defined by their dark matter component. Applying this framework to the simba cosmological simulations, we show that 40 per cent (10 per cent) of cosmological baryons have moved >1h−1Mpc (3h−1Mpc) by z = 0, primarily due to entrainment of gas by jets powered by an active galactic nucleus, with baryons moving up to 12h−1Mpc away in extreme cases. Baryons decouple from the dynamics of the dark matter component due to hydrodynamic forces, radiative cooling, and feedback processes. As a result, only 60 per cent of the gas content in a given halo at z = 0 originates from its LR, roughly independent of halo mass. A typical halo in the mass range Mvir = 1012–1013 M⊙ only retains 20 per cent of the gas originally contained in its LR. We show that up to 20 per cent of the gas content in a typical Milky Way-mass halo may originate in the region defined by the dark matter of another halo. This inter-Lagrangian baryon transfer may have important implications for the origin of gas and metals in the circumgalactic medium of galaxies, as well as for semi-analytic models of galaxy formation and ‘zoom-in’ simulations.