Here’s the upshot. There’s a difference between formal and material cooperation with evil. In the first case, you intend to enable the evil doer. In the second, you intend no such thing, only to limit him from doing an even greater evil act—thus, you do not share in his guilt.
Budziszewski illustrates the distinction between formal and material cooperation with the following imaginary dialogue between a professor and two of his students, Don and Thersea (edited slightly for space and clarity):
Professor Theophilus (PT): Let's say that candidate X and candidate Y both hold certain immoral positions, but candidate X is worse. If you vote for candidate Y because of his immoral positions, then you're intentionally cooperating with evil. That's called 'formal' cooperation. Formal cooperation is always wrong… But suppose you vote for candidate Y for a different reason. You don't do it to enable him to do bad things, but to prevent candidate X from taking office and doing even worse things. In that case you're not formally cooperating with evil.
Don: But you're sort of cooperating.
PT: It's true that the effect of your action is to make it more likely for candidate Y to take office, where he can do wrong. That's called 'material' cooperation. But in material cooperation, enabling him to do wrong isn't your intention. Your intention is to keep the candidate X from taking office where he can commit even graver wrong.
Don: I don't see why material cooperation isn't wrong too.
PT: Try an easier example. Suppose you're a teller in a bank. A robber grabs a customer, holds a gun to the customer's head, and says 'Unless you give me all the money in your drawer, I'll blow his brains out.' What should you do?
Theresa: Give him all the money in my drawer.
Don: I agree.
PT: So do I, but think about it. That's material cooperation too, isn't it? Giving the thief the cash has the effect of enabling him to commit theft, but that's not your intention. You're not trying to help him do wrong, either as a goal or as a means to some other goal. Your intention is merely to keep him from committing the even graver wrong of murder."
Theresa: I get it. You don't share in the guilt of stealing by giving him the money, because you're not trying to help him steal. And you ought to give it to him, because otherwise something even worse would happen."
PT: Right, and it's just like that when you vote for candidate Y. You don't share in the guilt of the wrong things he wants to do when you vote for him —
Don: Because you're not trying to help him to do them. And you ought to vote for him because if the other guy wins, he'd try to do something worse.