Indeed, for Robert E Lee personally and the Army of Northern Virginia in general, Gettysburg was a costly defeat; tactically that is. Although he had lost tens of thousands WIA and KIA, perhaps the most severe losses were felt in his mid-echelon officer corps. In addition to Corps Commanders Heth, Pender and Hood, he had lost some of his best brigade commanders (Brigadier Generals) and a slew of Colonels. The numbers of Majors and Captains lost was almost uncountable. Foot soldier can be replaced. True leaders have to be cultivated. His army was truly depleted of such personnel as he retreated.
And yet, there are aspects of the aftermath that could be considered to be a strategic victory. One of the factors that had driven Lee north was that his army was starving in NW Virginia. [Section 1f details some of the issues facing Lee in the spring of 1863.] On the way into Pennsylvania up the Cumberland Valley, Lee’s men had feasted on the bounty of the land. His quartermasters had ‘bought’ vast quantities of supplies of every imaginable variety. Livestock of all types were being herded back down into Virginia as the battle raged in southern PENN.
Add to this the 100+ wagons that Stuart’s Cavalry had ‘commandeered’ and the military supplies that Ewell had looted at Carlisle (although he was recalled before he could truly empty the warehouses) and the balance sheet of the spoils of war were in Lee’s favor.
[see Section 1f LOGISTICS]
In short, this rather brief incursion into the North had been costly in terms of personnel lost. But the spoils allowed him to regroup in Virginia and replace his manpower losses in due time. As such, he moved east again to protect Richmond and was able to battle on for two more years.