In view of applications to the study of regularity properties of minimizers for a continuous model of transportation, which is a kind of divergence-constrained optimization problem,
we prove a global $L^\infty$ gradient estimate for solutions of an elliptic equation, whose ellipticity constants degenerate at every point where $\nabla u\leq \delta$, with $\delta>0$. The exposition is as self-contained as possible.