Well, I don't really know much about residency selection, but I'll venture to guess...
First of all, I think all of these scores you listed are pretty much viewed as the same -- the USMLE is not like the MCAT where 1 point makes a big difference. Second, in the first hypothetical applicant, the applicant would have to have failed the USMLE one or two times in order to retake the exam (since you can't retake it if you pass)-- pretty significant since only about 5% of US med students fail the USMLE on their first attempt. I can't imagine that residencies would prefer an applicant who has failed Boards several times over ones that have passed it and done well on their first try, but again, I don't know what the residency program directors think.
Second, when you're talking about applicants scoring so closely together, residency programs would look at other factors. They look at other factors anyway, because I don't think any program uses USMLE as their sole basis for interviewing applicants.
Anyway, I'm sorry I'm not answering your question, but I don't think that in real life it's all that cut-and-dry. 🙂