Grant whittled away the ANV pretty well in 1865 without having them penned up.
But say Lee had managed to badly defeat Meade at Gettysburg, would he have taken Washington or Baltimore? No.
That is not a foregone conclusion.
Had he won then he would do what he did following defeat, go home. What choice did he have? He was deep in Northern territory without a supply line.
As Sherman found out about a year later, you did not need to have a supply line.
Lee's mentality after a victory was not to go home and wait for the next battle, but to press on.
He would have had thousands of wounded to care for.
He would have sent them to Virginia.
He would have shot off most of his ammunition.
Which he would have replenished from Union stores.
He would have had the Army of the Potomac, wounded but still dangerous, in the area.
Not if his plan to defeat it in detail had worked.
Again, I believe Lee's campaign would have eventually ended in defeat.
But he did not invade Pennsylvania with the intent of running straight back home.
He was looking for a major strategic victory.
Sherman was not facing a Confederate army on his march and didn't fight a pitched battle.
Lee's mentality after a victory was not to go home and wait for the next battle, but to press on.
Then why didn't he press on after Chancellorsville?
He would have sent them to Virginia.
He had no supply line established.
Which he would have replenished from Union stores.
Union stores where?
Sherman know at the time of Gettysburg that you didn’t need a supply line: Grant operated without a supply line at Vicksburg, as did Grierson’s raid.