We have very old fashioned voting machines that scan ballots marked by voters by hand. The paper ballots are retained in the machine after being scanned, and are picked up at the end of the day by sheriffs deputies.
There is another army of mostly city employees working all day and night, for several days, suporting the polling places (in a dozen languages) and processing all of the ballots. So it is indeed a costly system.
We have been able to vote by mail for many years, but for various reasona, about half of the voters prefer to come to the polling place to cast their ballot (and get an "I voted" sticker).
Meanwhile, Washington, Oregon and Colorado have only voting by mail. No voting machines no polling places, no army of workers all over town. No doubt there are issues with processing those ballots as well, but it removes the voting machines from the vulnerable spots in church dining halls and residential garages all over town.