When Drupal 8 was in beta this was changed intentionally to avoid bleeding of overridden values into configuration when you save it, see the change record Configuration objects by default are immutable.
This is what the configuration form does in static code:
\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