The (simplified for laymen) formula for calculating the velocity a probe would gain via the flyby of a planet is:
The Resulting Velocity of the Probe Relative to the Sun = v + 2U
... where v is the probe's initial velocity and U is the planet's orbital velocity.
So far so good. The analogy that is often adduced to clarify the process further involves a moving train and a tennis ball hurled at it from the platform. In the analogy, it is assumed that:
Initially, the direction in which the ball is traveling is the exact opposite of the train's movement
The ball has perfect elasticity (i.e. no energy at all will be lost when it bounces off the front of the train)
For the sake of simplicity the air resistance should be ignored
The mass of the train is so much greater than the mass of the ball that the train's velocity is not affected (and the gained velocity of the ball is therefore not affected by the train's loss of energy resulting from the impact).
By the same token the mass of, say, Venus is so much greater than the mass of a space probe, that the effect the gravity assist maneuver has on the planet is so insignificant it can be safely ignored. Which is to say, even though while passing some of its kinetic energy to the probe Venus must inevitably lose some of its orbital velocity, the loss is infinitesimal and of no interest to anyone.
Thus to all intents and purposes the gained velocity is 2U, not less.
My question is how would this (simplified) formula look if mass were, in fact, a factor? If the train were only, say, ten times heavier than the tennis ball?