I am currently employed at a middle-sized company. The pay and work environment aren't great, so I've been looking for another job for the past few months.
About 5 weeks ago (March 11 for the sake of simplicity), I interviewed at a large Fortune 500 company (let's call it "Company A"). I felt like it went well, but a few days later the job was re-posted on the website. I asked the hiring manager at Company A and he said it was routine to allow them to interview more people internally.
Assuming that I wouldn't get this job I continued looking, and went through a 3-week interview process with a small company ("Company B", about 50 employees) that eventually made me an offer. I countered with a pretty big increase, and they met it by sending me a pdf of the revised contract. I said over the phone that the offer "looked good", and put in my two weeks notice at my current employer (this was on April 4). Company B and I established that I would start on April 22, and sign my contract then.
Now it is April 16th and, along with being very apologetic for the delay, the hiring manager at Company A calls me with an offer that beats even my revised amount with Company B by a significant margin (even before the counter offer that I plan to make). The jobs themselves are pretty comparable, but along with the better pay I would be slightly more comfortable working in Company A's stable corporate environment.
Given Company B's size, it might be a huge blow to them to have spent so much time interviewing me and waiting 2+ weeks for me to start only for me to say "never mind". If I take Company A's offer, I would immediately give Company B a tactful note or call to let them know the situation.
TL;DR: I have all but signed the contract for one offer, but a significantly better one was made by another company. So the question is: is it acceptable for me to take the better job offer days before starting at the other one, or will this somehow blacklist me? Am I legally obligated to any certain action, possibly including mentioning Company B on my future resume? Is there any other action I should take?