"If it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic."
This is simply a literary play on words - One that uses the sort of confused and ambiguous logic that Carroll is well-known for. In it's most basic form it is a simple confusion of subjunctives inside an, 'Alpha AND Beta' format. The thought process is deliberately confused, runs in a circle, and comes to an unexpected end without reaching any sort of useful conclusion.
In order for the logical statement, 'alpha and beta' to be true both alpha and beta must be true. If either one is false then the import of the entire statement collapses. The contrapositive, 'alpha or beta' might be a viable alternative; but with confusion as his desired goal, Carroll knew better than to introduce an opposing conjunction.
One thing is certain: You cannot correctly use, 'if' and, 'was' in the same simple sentence, and remain grammatically correct. 'If' implies, 'were'; and that's a tough subjunctive structure to get around. (It can be done; but a highly descriptive context would be needed.)
Look at it this way: 'If it were so, it might be; and if it were so it would be; but as it isn't, it ain't.' 'That's logic.' If you change, 'was' to were, and recognize the fact that, 'alpha AND beta' (by the author's own admission) is a true statement, then, instead of relying upon logic, Carroll's compound assertion is actually referring to the preposterous development of an, otherwise, certain event.
However, with both, 'alpha and beta' being incorrect the entire statement is grammatical gobbledygook that fits in very well with the bizarre world of illogical impossibilities that Carroll so eloquently portrayed.