Because they're cheaper. I lived in counties that formerly used mechanical voting machines. They were replaced by electronic ones when the cost of maintaining them became higher than the replacement cost. If security was considered at all, I speculate that it was not the highest priority.