Merriam-Webster's A Dictionary of the English Language (1864) notes that either by or bye (as a noun) could mean
A thing not directly aimed at; something which is a secondary object of regard; an object by the way, and the like; as in on or upon the bye, in passing; indirectly; by implication.
The related phrase by the bye, it reports, means
in passing; by way of digression; apropos to the matter at hand.
Interestingly, this dictionary does not offer by the by as a variant spelling for by the bye.
This definition clarifies Charles Dickens's meaning in the following sentence from Dombey and Son (published between 1846 and 1848):
So they got back to the coach, long before the coachman expected them; and Walter, putting Susan and Mrs Richards inside, took his seat on the box himself that there might be no more mistakes, and deposited them safely in the hall of Mr Dombey's house—where, by the bye, he saw a mighty nosegay lying, which reminded him of the one Captain Cuttle had purchased in his company that morning.
The previous Merriam-Webster's A Dictionary of the American Language (1847), however, lists only the spelling by the by, commenting,
By the by, signifies, as we proceed or pass, noting something interposed in the progress of a discourse which is distinct from the main subject. The old phrase, 'on the by,' on the passage, is now obsolete.
UPDATE (March 3, 2015): Origin of the phrase
Merriam-Webster's Eleventh Collegiate Dictionary (2013) offers the following relevant entries for by or bye:
by or bye adj (14c) 1 : being off the main route : SIDE 2 : INCIDENTAL
by or bye n, pl byes (1567) : something of secondary importance : a side issue
Consistent with those definitions, the Eleventh Collegiate has this for by the by or by the bye:
by the by or by the bye : INCIDENTALLY [defined as "by way of interjection or digression : by the way"]
The earliest Google Books match for “upon the bye” is from Sir Thomas Overbury’s copy of "The Arraignment and Conviction of Sir Walter Raleigh, at the King’s-Bench Bar at Winchester, on the 17th of November 1603,” printed by William Wilson in 1648, and reproduced in A Collection of Scarce and Valuable Tracts, on the Most Interesting and Entertaining Subjects (1751). Overbury's copy actually uses the words “upon the bye” twice:
Some [observers of the trial] noted his [Mr. Attorney Cook’s] care and diligence in delivering to the people, that the King said he would loose lands, crown, and life, before he would suffer a toleration or alteration in Religion ; and that to these Traytors (for Cobham and Gray were upon the bye) he had done nothing rigorously, nothing unnaturally, nothing precipitately ; not rigorously, because no torture used : not unnaturally, because the brother was not pressed (further then he would) to accuse his brother “ not precipitately, because of the long time his gracious Majesty had promised before he would bring them to their Arraignment ; this was much to the satisfaction of the people, but this he was commanded to deliver.
The accusation may be said to be of two parts, viz. Personal against the King, and publickly against the State and quiet of the Realm, both high Treason ; the personal Treason was of two sorts. The first a conspiracy against the King’s life : the second a practice to disable the King’s title to the Crown of England. To prove Raleigh intended the King’s death, the confession of George Brooke was enforced, who said that his brother my Lord Cobham told him that he and my Lord Gray were but upon the Bye, but the said Cobham and Sir Walter Raleigh were upon the main for it, and should never be well till the King and his Cubs were taken away.
The occurrence of “upon the bye” in the Overbury account on two occasions emphasizing the lesser culpability of two of the Main Plot conspirators (rather confusingly identified) suggests that this is no mere paraphrase of testimony taken at or before the trial. It seems very possible that something very like that expression may have been said (probably by George Brook) at or prior to Raleigh’s trial in 1603.
Another early instance is from a letter to the Mayor of Southampton” (not later than 1623), in Acts of the Privy Counsel of England (1623) [combined snippets]:
Forasmuch as we have thereupon received a reporte in writing from his Majestie’s Sollicitor Generall wherein it appeareth that he, having heard both sydes, is of opinion that the peticioner should have satisfaccion for his dammages and paynes taken and sustayned by occacion of that suite wherin he was imployed first by Turgis (and did nothing therein but as an Attorney for his clyent) and that therfore he thinks fitt that the executrix of the said Turgis ought to pay the peticioner the some of twentie nobles towards his said paynes and disbursments, with further opinion delivered by Mr. Sollicitor in his certificate that in regard much charge and dammage otherwise hath happened to the peticioner (in the prosecucion in this cause) by accident and upon the by, that the same should likewise lefte to be further considered of when the peticioner should make it appeare who were the occacion thereof ; in all which we fynding cause to concurr with the certificate of his Majestie's Sollicitor Generall have thought fitt hereby to pray and require you to assist the practicioner by all lawfull meanes for obtainneing of the said some of twentie nobles from the executrix of Turgis with as little delay and charge to the peticioner as may be.
This excerpt is built from multiple snippet views, none of which include a precise date; but the record of the Turgis decision appears just before an entry involving Privy Council approval of a request by three Englishmen to travel abroad for three years, contingent on their not visiting Rome for any reason—language that similar Privy Council decisions from circa 1613–1614 employ.
The variant “upon the bye” appears in Thomas Morton, Of the Institution of the Sacrament of the Blessed Bodie and Blood of Christ (1635) [combined snippets]:
This point falling in but upon the Bye‚ I then thought it not worthy the insisting on; and have beene since called upon by a Romish Opposite, to satisfìe him, why I should father this opinion on your Church : as though this Mixture of water and wine had been ordained by Christ, for his Church, under a necessity of Precept.
A somewhat later book, John Bramhall, Castigations of Mr. Hobbes (1658) contains three occurrence of “upon the by” in the course of his efforts to demolish the arguments of that notorious philosopher.
Later still is the first Google Books match for “on the by”—from a letter by Anthony Lucas published in Philosophical Transactions of the Royal Society of London (September 25, 1676):
Next I removed the mentioned Circle from the Shuts, and placed it in the open window, supported only by the edge d : whereupon, to my astonishment, all the former Colours exchanged postures in the Retina, the Scarlet now appearing below, the Violet above ; the intermediate Colours scarce discernible. And here, on the by, 'tis very remarkable, that, during this Observation, I clearly perceived both Blew- and Scarlet-light to be transparent, I being able to discern several objects through both, namely Steeples opposit to my window.
As for “by the by” and “by the bye” proper, the earliest Google Books matches are much in favor of the former variant, beginning with this example from a review of W. Sympson, Zymologia Chymica* in Philosophical Transactions of the Royal Society of London (September 26, 1675):
He [Sympson] offers also, from the same principles to explain the two great phænomena of Heat and Light, found in concrete bodies ; yet leaving it to further examination, whether in that great Fountain of Light, the Sun, its perpetual emanation of Light may not consist in a peculiar fermentation of its own, set a work by the Creator, and kept a foot by a continual circulation of Ethereal matter : Endeavouring in the mean time to shew, 1. How Heat is produced from fermentation in all such bodies where ‘tis found. 2. How from the same Principles of Acid and Sulphur Light is made. Where by the by, he labours to prove, that the Fermentation in Mineral Juices, whether natural or artificial, proceeds not from the Contrariety of Salts, because there is no such ebullition among Salts, but what is from the conflict of Acids and Sulphurs, ...
And the earliest instance of “by the bye” is from William de Britaine, Humane Prudence: Or, The Art by Which a Man May Raise Himself and Fortune to Grandeur, sixth edition (1693; first published in 1680, but much revised in the third edition of 1686):
It's a delicate part of practical Knowledge, well to observe and guess at the meaning of the little Hints that are given you by the bye, and to know how to improve them ; this is the finest Probe of the Recesses of the Heart : But as they are sometimes cunningly given out, so are they cautiously to be received.