Are formal and functional linguistic mechanisms dissociated in language models?