Overlapping post-doc positions
As a department chair at a US university who has on various occasions negotiated these sorts of overlapping/adjacent postdoc arrangements with job candidates, I can tell you that at least in the US (and, I strongly suspect, in many other countries) it would be considered highly unethical to set up an arrangement of this sort without informing and getting the agreement of the directors/department chairs at both institutions A and B, and is very likely to get you into trouble if you are found out (an event which itself seems quite likely, although that is harder to estimate), with possibly very bad consequences for your career. You can be sure that the negative financial effects of those consequences (even assuming money is the only thing you care about, which probably is untrue) would be of a much greater order of magnitude than the extra money you are trying to squeeze out of your third month of stay at Institution B. And keep in mind that this is not just an ethical matter -- at my institution specifically you would certainly be violating some institutional policies, even if in a practical sense you would still manage to meet your teaching obligations. If you are somehow thinking that "it is better to beg for forgiveness than to ask for permission", please trust me -- this is not a situation where that saying applies.

In short, DON'T DO IT. Bring the department chairs and/or faculty mentors on board and see how they can help you achieve your goals. As I said, in my department we occasionally try to help postdocs combine their stay at my university with another short-term visit to another institution, and recognize that this can work to everyone's benefit, but it must be done honestly and with the full knowledge and cooperation of all involved parties.