I'd like to know if "before" and "in front of" is equally common in a sentence like this in American English? Is one more formal than the other?
Elina stands before/in front of a vending machine, considering her options.
Before is either a bit formal or could be used for stylistic effect, if used in this context. She may well stand before the Bench in a Court of Law...
I would say that a vending machine would only warrant "standing in front of", in the normal course of events.
The before / in front of distinction (when they have essentially the same meaning, which certainly isn't always the case1) isn't really about "formality". Mostly it's just that to stand before [something] has been in long-term decline by comparison with to stand in front of [it]. This doesn't create a very strong distinction, but before in such contexts is at least slightly "stilted / dated / old-fashioned".
In practice, I suspect the vast majority of native speakers would use by (or even at) in the exact cited context.
In other contexts, to stand before X is the preferred preposition where X represents an "audience" (that interacts with the subject, rather than just being "nearby"). Particularly, a judgmental audience - to stand before a jury is often a "metaphorical" reference to being under scrutiny, whereas to stand in front of a jury might just be about actual relative positions in space.
1 There's also the distinction reflected in the time-worn pun "How dare you break wind before the Queen!" - "I'm sorry, I didn't know it was her turn!, playing on the fact that before can mean earlier in time, as well as in the presence of, [physically] in front of.
Okay, I am not a native speaker, but this seems to be an easy task, so let's borrow the BBC's explanation about the difference between in front of and before.
As a preposition.
Before is not normally used to refer to place. We normally use in front of to specify place the opposite of which is behind. Compare the following:
Sam was sitting in front of my girlfriends in the cinema but behind my sister.
I was waiting patiently in the queue. In front of me there were about two hundred people and behind me a further three hundred.
Before is normally used as a preposition to indicate time. Its opposite of which is after:
Your brother arrived at the church shortly after three, but I distinctly remember saying to everyone: "You must be in your seats at or before three o' clock".
Excuse me, I was here before you. I should therefore be in front of you in the queue.
However, before is used to refer to place when it indicates position in a list or when it means in the presence of somebody important:
K comes before L in the alphabet, but after J. He had behaved so badly in school that he was brought before the headmistress.
I was accused of dangerous driving but rather than pay the fine, I elected to appear before the local magistrates.
Note that in these last two examples before means facing and not one behind the other.
Before (conjunction or adverb)
Before is often used as a conjunction linking two clauses or as an adverb of time, meaning at some time before now.
Give me a ring to let me know you are on your way before you leave the house.
Make sure you get to the church before the bride arrives.
Before she married Maurice, she went out with Austin for a couple of years.
He was certain we had met before, but I was equally sure we hadn't, for I had never been there before.
Within two minutes of it starting, I realized that I'd seen this film before.