The role of osmotic pressure in the analogy between solutions and gases