Examiners are not identical in their search approach and their judgment. Two inventions for the “same thing” have distinct descriptions and different claim wordings, and different IDSs submitted. And, last, the two applicants have different people representing them before the office. So different outcomes under the same prior art are not ridiculous.
The first application does not constitute prior art unless it was published or otherwise publicly disclosed. Since normal publication us 18 months after filing and the time to first action is on that order, it might or might not be published at the time the second filing.
If course an initial rejection can be fought and overcome or fought and fought for quite a while and an “acceptance” means an allowance which then take a couple of months to turn into a grant.
For the second filed to be accepted (let’s say allowed) before the first one gets its first action in the merits can happen if the second one is accelerated for age or by paying a fee or if the first is delayed due to restriction requirements, missing paperwork, etc.
If the first filed is not visible to the examiner of the second one the second filed can get a patent while the first filed one does not for any of the reasons above.
I think the only remedy for the first inventor is to file an IPR (not cheap) to get the second applicant's patent invalidated. If the first applicant does not still have an application or continuation application on file, they are not going to get a patent.
Of course once the earlier application is published it should be clear that the issued patent has a low likelihood of being enforced since a search by anyone approached by the patent owner will see the prior art and know that there is no teeth in the issued patent.