The Thermodynamics of Swelling