Depends on the speed and weight of the bullet, length of the barrel and the recoil characteristics of the given firearm.
Short version is
@waksupi is correct.
My personal experience with this is with 4" barreled .38 Special/.357magnum revolvers.
I learned this as a Border Patrol Trainee at the academy, a hundred years ago
, where we shot thousands of rounds with our Smith 686s or Ruger GP100s (I had a Smith) with 4" barrels. Most of the rounds we fired were .38 Special wadcutters "practice/competition" rounds, but we also fired duty loads of .357 Magnum rounds. The Magnum rounds were lighter 110 gr JHP bullets, but at much higher velocity than the .38 rounds which were 148 gr HBWC.
After months of practice, there were two qualification courses to be shot, a longer one with more rounds with the .38 loads and then a shorter one with fewer magnum rounds. We were all keen to qualify, and as was our competitive nature, to try to qualify as high in the class as we could. Our instructor took our small group 4-5 of us aside and explained that the magnums and the .38s would have different points of impacts, the magnums shooting lower, no matter the distance. Those of us who listened, understood and believed his explanation (our instructors were among the best in the world at the time and all National Team members for BP) all qualified better than those who didn't get it. There was a quite marked difference, significant in scoring.
His explanation and what was actually happening? The much slower .38 Special rounds had a longer
dwell time in the barrel and though they were heavier and going slower by the time they had exited the barrel the difference in that time between them and the much faster magnum rounds, fractions of a second, allowed the barrel to rise just that bit, prior to the slower heavier bullet exiting to raise the impact point. And so it was the case with every one of us, though we were all shooting identical or near identical revolvers with ammunition from the same lot off the same pallet straight from the factory. I understand there are mathematical ballistics formulas that illustrate this effect.
That's my story and I'm sticking to it