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 https://www.drupal.org/node/2408549


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