Keep a set of objects from casting shadows while having a shadow
I’m answering my own question. The solution was found while working on the compositing phase.

It is possible to do this using view layers and compositing. It is necessary to create an masking object, in this case a sphere centered on the Earth and with the same size as the atmosphere, with all needed relations to follow it during animation. Then, in the “Object” panel, the “Visibility” section is set like this:



The “Holdout” makes the masking sphere appear like the background (in this case transparent, as usual with view layers). In unchecked every other boxes except “Camera” to avoid interference with lighting.