  Starting from a purely algebraic procedure based on the commutant of a
subalgebra in the universal enveloping algebra of a given Lie algebra, the
notion of algebraic Hamiltonians and the constants of the motion generating a
polynomial symmetry algebra is proposed. The case of the special linear Lie
algebra $\mathfrak{sl}(n)$ is discussed in detail, where an explicit basis for
the commutant with respect to the Cartan subalgebra is obtained, and the order
of the polynomial algebra is computed. It is further shown that, with an
appropriate realization of $\mathfrak{sl}(n)$, this provides an explicit
connection with the generic superintegrable model on the $(n-1)$-dimensional
sphere $\mathbb{S}^{n-1}$ and the related Racah algebra $R(n)$. In particular,
we show explicitly how the models on the $2$-sphere and $3$-sphere and the
associated symmetry algebras can be obtained from the quadratic and cubic
polynomial algebras generated by the commutants defined in the enveloping
algebra of $\mathfrak{sl}(3)$ and $\mathfrak{sl}(4)$, respectively. The
construction is performed in the classical (or Poisson-Lie) context, where the
Berezin bracket replaces the commutator.
