Having them in the sidings means they need *less* maintenance compared to running around empty.
Of course having no longer train at all means you save maintenance and the cost of the train in the first place (plus some other costs, notably electricity for traction and track access costs, and the costs of a driver to get it to and from the sidings in the day).
For the London commuter market (for outer suburban services that go to/from the Home Counties), it is generally the case that the cost of providing a longer train on a peak service that is already operating is more than covered by the extra revenue it generates, even if it only operates one service in the morning, and one in the evening, spending the rest of the day in sidings. This assumes no extra infrastructure is required for the longer train.