I will give an example with the moon.
If some spacecraft is put either in orbit around both earth and moon or in highly eccentric orbit that intersects with the moon orbit, some other spacecraft can dock to it and "ride" it to the moon.
A problem will be docking with so much faster craft on different orbit and also slowing down of this craft over time, but it can gain speed from gravitational slingshots from the moon, or it can be reboosted with cheap fuel from the moon for example?