Some of the companies building these horribly insecure voting machines are originally ATM companies, so I do not think we have any reason to think that ATMs are secure. There have also been incidents where ATMs have been hacked.
ATMs are also an easier problem since they do not care about anonymity, part of the cryptography is done on the card, and they do not have to work without a netowrk connection.
There's cryptography in a magnetic strip? That's news to me. And sure, some ATMs have been hacked, but in general there's a financial incentive for companies to keep them more secure than not, because, well... it gives you money.
And anonymity? The card itself just has a very long string of numbers to identify someone; information about the human it belongs to is optional. Whatever human that is currently verifying if you are allowed to vote can deal with giving you a card to cast your vote; it doesn't actually have to have anything other than a unique number.
ATMs only need a network connection to authorize a transaction. All the other aspects of it are offline, and it creates a paper trail, and saves records in memory. They could very easily be reconfigured to display voting options (and instructions!) and record the tallies both in memory and printed, both internally and externally, and OPTIONALLY connect to a remote server to log the transaction - securely, I might add.
AIUI most ATM's will still give you money up to a couple hundred bucks with their network connection down, in case of legitimate "storm took out the phone lines but people need cash to buy candles and blankets" situations. This is not as sketchy as it sounds because the financial clearing system is only eventually consistent anyway.
But obviously this attack surface has been exploited quite a lot by ATM crackers.
I do not think many, if any, ATMs in my country accept cards with only the magnetic strip anymore. It was over 10 years ago my ATM card was replaced by debit card when the banks phased out ATM cards.
And anonymity of votes has more aspects than just protecting against the guy by the machine. You also need to protect against to guy issuing the numbers (which you don't for ATMs, it is ok if the bank knows how much money you withdrew :)) and also the anonymity should make it hard to sell votes which disqualifies some cryptographic solutions suggested by other commentors (those where you get a cryptographic receipt which can use to look up afterwards to see what you voted).
And some voting machines work exactlty like you describe, and they are not regarded as secure.
ATMs are also an easier problem since they do not care about anonymity, part of the cryptography is done on the card, and they do not have to work without a netowrk connection.