In a configuration form you should use `$this->config()` and not `\Drupal::config()`.

The difference is, that the configuration form uses immutable configuration. When Drupal 8 was in beta, this was introduced to avoid bleeding of overridden values into configuration when you save it. See the change record:

[Configuration objects by default are immutable][1]

This is what the configuration form does in static code by using `$this->config()`:

    \Drupal::configFactory()->getEditable('system.site')->set('name', 'My fantastic site')->save();

------------------

For Drupal 8.5 it is discussed to display a warning in the configuration form, that there are overridden values:

> This form contains values that have been overridden. Changes to these
> values can still be saved, but the overridden values will take
> precedence. Overrides are as follows ...

See the issue:

[There is no indication on configuration forms if there are overridden values][2]


  [1]: https://www.drupal.org/node/2407153
  [2]: https://www.drupal.org/node/2408549