Found it! Left here to help future visitors:
In "Grade Category Settings" (http://127.0.0.1/moodle/admin/settings.php?section=gradecategorysettings) if the option "Allow category grades to be manually overridden" is checked, the teatcher can override the mean of grades manually. I unchecked this option.
This option is checked (on) by default, but is a really dangerous option. This should be off by default.
In "Grade Category Settings" (http://127.0.0.1/moodle/admin/settings.php?section=gradecategorysettings) if the option "Allow category grades to be manually overridden" is checked, the teatcher can override the mean of grades manually. I unchecked this option.
This option is checked (on) by default, but is a really dangerous option. This should be off by default.