Although the constitution made provision for creating a new capital, it didn't exclude the possibility of retaining it in an existing city. Winning the war and their independence with Richmond as the capital might create a sentiment for keeping it so.
If Maryland remained with the Union, the US government would be in the curious situation of having its capital on the border, literally under the guns of its recent enemy, assuming Virginia retained all of its territory on the right bank of the Potomac; I imagine they'd take back their piece of the District of Columbia. There would be a prestige argument to keep the capital where it was, but some obvious practical ones for moving to someplace like New York or Chicago. The US "abandoning" Maryland might also encourage that state to join the Confederacy, unless the peace settlement prohibited such changes.
Whether they liked it or not, the two nations' biggest foreign policy concern would be dealing with each other, so there would be a case on both sides for keeping the capitals reasonable close. I've always thought/hoped that good relations could be restored/maintained after a separation, peaceful or otherwise.
Nations do occasionally have their capitals on their borders, especially on rivers, like Buenos Aires or Ascuncion (Paraguay). The capitals of the Republic of the Congo and the Democratic Republic of the Congo (ex-Zaire) Brazzaville and Kinshasa, face each other across the Congo River.