Let X and Y be two compact spaces endowed withrespective measures μ and ν satisfying the condition µ(X) = v(Y). Let c be a continuous function on the product space X x Y. The mass transfer problem consists in determining a measure ξ onX x Y whose marginals coincide with μ and ν, and such thatthe total cost ∫ ∫ c(x,y)dξ(x,y) be minimized. We firstshow that if the cost function c is decomposable, i.e., can berepresented as the sum of two continuous functions defined on X andY, respectively, then every feasible measure is optimal. Conversely,when X is the support of μ and Y the support of ν and whenevery feasible measure is optimal, we prove that the cost function isdecomposable.