In terms of primary production, it is often described in textbooks that nitrogen is the most limiting nutrient in terrestrial ecosystems, while phosphorus is the most limiting nutrient in freshwater ecosystems. What creates this difference?
The traditional explanation for this is that nitrogen compounds are more mobile than phosphorus compounds. As a result, nitrogen is more likely to flow through terrestrial ecosystems and accumulate in freshwater ecosystems, making P relatively more limiting than N in freshwater.
Phosphorus compounds (e.g., phosphate) are more "sticky" and tend to bind/sorb to compounds in the soil and aquatic sediments, e.g., ferric compounds. Thus, most phosphorus gets bound up in terrestrial ecosystems because it's less mobile than nitrogen, or gets bound up in aquatic sediments. As a result, nitrogen becomes relatively more limiting than phosphorus in terrestrial ecosystems, and the phosphorus that does enter freshwater ecosystems often becomes inaccessible to biological organisms like primary producers.
Note that this paradigm is a generalization, and is dependent on many other factors. Lake pH and concentration ferric compounds can regulate whether the sediments are sources or sinks of P; anoxic conditions can lead to denitrification, a loss of N that could offset N inputs. Anthropogenic additions of N and P (either to the freshwater system directly or to the terrestrial ecosystem that drains into it) could dramatically perturb the natural balance between N and P limitation in terrestrial and aquatic ecosystems in a way that does not conform to the paradigm.
Some references you might find useful:
Elser, J. J., Bracken, M. E.S., Cleland, E. E., Gruner, D. S., Harpole, W. S., Hillebrand, H., Ngai, J. T., Seabloom, E. W., Shurin, J. B. and Smith, J. E. (2007), Global analysis of nitrogen and phosphorus limitation of primary producers in freshwater, marine and terrestrial ecosystems. Ecology Letters, 10: 1135–1142.