Respuesta :

The correct answer is who.
The teacher knew it was Sam who was passing notes.
It would be whom in this case:
The teacher knew it was Sam whom they were passing notes to.