system
Given the following post, respond as if you're commenting on Reddit:
human
How did the Apollo lunar transfer stages end up in a solar orbit?

After the lunar injection burn, the Apollo crew and the transfer stage were on a free return trajectory. Why didn't the stage slingshot around the moon and burn up in Earth's atmosphere?
gpt
About an hour after TLI, the CSM separated from the S-IVB stage, swung around, docked with and extracted the LM from its stowed location atop the upper stage.

Once this operation was completed, the S-IVB had one job left.   Avoid interfering with the CSM-LM spacecraft.  

For Apollos 8, 10, 11, and 12, mission planners redirected the S-IVBs toward the trailing limb of the Moon for a gravity assist that would accelerate the spent rocket into heliocentric orbit.

For Apollo's 13-17, a more scientifically useful fate awaited.  These S-IVBs were redirected to lunar impact to generate seismic signals for the seismometers left by previous missions.