This paper presents a Hamiltonian variational formulation to determine the energy minimizing boundary conditions (BCs) of the tensionless contact problem for an Euler–Bernoulli beam resting on either a Pasternak or a Reissner two-parameters foundation. Mathematically, this originates a free-boundary variational problem. It is shown that the BCs setting the contact loci, which are the boundary points of the contact interval, are always given by second order homogeneous forms in the displacement and its derivatives. This stands for the nonlinear nature of the problem and calls for multiple solutions in the displacement, together with the classical result of multiple solutions in the contact loci position. In particular, it is shown that the Pasternak soil possesses an extra solution other than Kerr’s, although it is proved that such solution must be ruled out owing to interpenetration. The homogeneous character of the BCs explains the well-known load scaling invariance of the contact loci position. It is further shown that the Reissner foundation may be given two mechanical interpretations, which lead to different BCs. Comparison with the established literature is drawn and numerical solutions shown which confirm the energy minimizing nature of the assessed BCs.