We are interested in the rate function of the moderate deviation principle for the two-sample matching problem. This is related to the determination of 1-Lipschitzfunctions with maximal variance. We give an exact solution for random variables which havenormal law, or are uniformly distributed on the Euclidean ball.