We give criteria for finite or infinite dimensionality of the polynomial centralizer of the Lie algebra of a linear Lie group, in terms of invariants and relative invariants of the group. In the finite-dimensional scenario some applications to normal forms and to certain equations with fundamental solutions are presented.