The 1858 Wright edition replaced the preposition by with before, probably because of the following before (“before the sun”). The first two RLDS editions followed this reading, but in the third RLDS edition (1908) the original by was restored. The use of by them in Mormon 4:18 is undoubtedly correct since it is the earliest reading.
Of course, either before or by will work here in Mormon 4:18 (although there is a difference in meaning). In fact, there is an actual case of before them for the phrase “to sweep off ”:
In this case, the agentive preposition by is not possible since the second clause is in the active voice (“they ... swept off the inhabitants”).
Summary: Accept in Mormon 4:18 the prepositional phrase by them, the reading of the earliest textual sources.