<p>The corporation decided to offer the scholarship to whoever did the most work in the graduating class.</p>
<p>It is no error. Think of it in parts. Whoever is equivalent of he/she while whomever is equivalent of him/her. So just replace whoever with both he/she and him/her. It is now obvious that you don't say: him did the most work.</p>
<p>So the second part of the sentence, after the "to," overrides the "to?" Err, "to" usually takes an object; the rule is that when deciding between object/subject, make sure the verb is satisfied before the preposition?</p>