On the use of grant funds for extracurricular research While reading the PUBLICATIONS PRODUCED AS A RESULT OF THIS RESEARCH section of some completed NSF award abstracts, I expected to find papers only within the limited scope of the goals of the proposal.  To my surprise, I have found some papers in completely unrelated topics credited to the research grant that funded it.  It doesn't even seem like a serendipitous finding or semi-related tangent either, but rather a complete deviation from the grant's intended purpose.  

I'm sure that there are other justifications for attributing research grants for publications as stated in this post, but it made me wonder...

How can one justify using grant money to fund research outside of your intended purpose of the grant?  Is this a common practice?  Are there any negative consequences to using your grant to fund extracurricular research activities?  Under what circumstances is it valid to do so and when is it inappropriate to do so?
I've also been funded by NSF's Division of Mathematical Sciences, so I can respond personally.  To first-order approximation, the only resources that research grants in mathematics (and similar fields, like theoretical computer science) provide is money to buy food to supply brain cells.

If my brain cells (or my students' brain cells) produce research results during the active period of a grant, I always acknowledge the grant in the resulting paper and I always list that publication in my reports to NSF.  It doesn't matter whether the work is directly or even tangentially related to the research outlined in the proposal.

If that seems inappropriate, consider the alternatives: (1) Shut off any part of my brain that is not thinking specifically about the proposed work.  (2) Allow myself to think about other stuff, but don't acknowledge the grant if I actually make progress.  The first alternative requires irreversible  surgery that I am unwilling to perform on myself, and the second is completely unethical.