There was certainly a debate at one point because particularly in Ragnarok, it establishes that Thor can summon the lightning without the hammer. I think Odin even says, ‘It was never the hammer.’ And yet Cap summons the lightning with the hammer. You get to those things and you’re like, ‘It’s too awesome not to do it! We’ll talk about it later.’
Our understanding from the first time we meet Thor in his first solo picture, is that Mjolnir the hammer is the place where Thor draws his power. Without the weapon, he isn't really the God of Thunder because his ability to summon lightning actually comes from the hammer.
However, in Thor: Ragnarok Thor discovers that the power is actually part of him, and that he can summon it all at will. The hammer acted only as a focus that helped him control and harness the power, when it is destroyed in that film, Thor's power ends up going wild.
And so, if the power to summon lightning is part of Thor, and not the hammer, then Captain America shouldn't technically be able to summon the power simply because he's capable of wielding the weapon.
In the end, the decision was made to simply let it go, and to be honest, i didn't hear anybody complaining about the apparent continuity problem. The sequence where Captain America holds Mjolnir was one of the most popular among fans and it was only made more fun by the lightning.
It's not like they can't write in an explanation for the lightning if they really want to. We know that somebody else is going to be using Mjolnir before too long. Jane Foster is set to become The Mighty Thor in Thor: Love and Thunder. Unless she has no lightning powers at all, it would seem that perhaps Mjolnir is capable of bestowing such an ability, even if Thor happened to be able to do it anyway.