A COMMUTATIVITY CONDITION FOR ALGEBRAS OF INVARIANT FUNCTIONS