We point out a surprising feature of diffusion in inhomogeneous media: under suitable conditions, the rectification of the Brownian paths by a diffusivity gradient can result in initially spread tracers spontaneously concentrating. This geometric ratchet effect demonstrates that, in violation of the classical statements of the second law of (non-equilibrium) thermodynamics, self-organization can take place in thermodynamic systems at local equilibrium without heat being produced or exchanged with the environment. We stress the role of Bayesian priors in a suitable reformulation of the second law accommodating this geometric ratchet effect.