A particle constrained to a finite interval has quantized energy. A "free particle", that can move any where in space, has continuous energy. Mathematically, that is because the eigenvalues on a finite interval (where you can use a Fourier series) are discrete while the eigenvalues on an infinite interval (where you can use a Fourier integral) are continuous.
Energy is not quantized in this case because the free particle does not represent a possible physical state. Rather, it is a useful description in the study of one dimensional scattering. None of the eigenfunctions of the moment operator live in Hilbert Space, thus they do not represent a physically realizable state. However, you can recover Dirac Orthonormality and the eigenfunctions are complete, so the free particle is very useful when applied to other problems.
What's always quantised is action; energy * time, momentum * position,...
Energy becomes quantised in consequence when time is constrained to discrete values, such as the period of a photon, or of an electron in orbit. Free electrons have no such time constraint.