The food webs of terrestrial soils and of freshwater and marine sediments depend on adjacent aboveground or pelagic ecosystems for organic matter input that provides nutrients and energy. There are important similarities in the flow of organic matter through these food webs and how this flow feeds back to primary production. In both soils and sediments, trophic interactions occur in a cycle in which consumers stimulate nutrient cycling such that mineralized resources are made available to the primary producers. However, aquatic sediments and terrestrial soils differ greatly in the connectivity between the production and the consumption of organic matter. Terrestrial soils and shallow aquatic sediments can receive organic matter within hours of photosynthesis when roots leak carbon, whereas deep oceanic sediments receive organic matter possibly months after carbon assimilation by phytoplankton. This comparison has implications for the capacity of soils and sediments to affect the global carbon balance.