Boundary terms and on-shell action in Ricci-based gravity theories: the Hamiltonian formulation | Publicación