Do course buyouts happen in pure mathematics? I am a pure mathematician teaching a 2-2 load at a state research university in the United States. I know that many of my colleagues in applied math, engineering, and the laboratory sciences are able to buyout much of their teaching as long as they are successful in obtaining grant funding.

This doesn't seem to be the case in pure mathematics, however. In the US, most external funding for pure math comes from the NSF or the NSA. A program officer at the NSA explained to me that they don't allow buyouts, even in lieu of requesting summer salary. I e-mailed the same question to a program officer at the NSF, and my e-mail was not returned. I also asked my chair if I could pay for a buy-out (down to 2-1) from my own money, and he said no -- only grants or startup money are acceptable for this purpose.

I am curious -- are pure mathematicians ever able to secure course buy-outs, other than in their first few years (when this seems common)? Are there any funding agencies whose funding I might compete for that allow this? Alternatively, are buyouts from salary acceptable in other departments?
The NSF won't generally allow a faculty member to take more than 2 months of salary per year from NSF grants.  Since you would typically want summer salary before buying out of teaching, this effectively makes it impossible to buy out of teaching on NSF funding alone.  

However, if you combine your NSF funding with funding from other agencies (such as the Office of Naval Research, Army Research Office, National Geospatial Intelligence Agency, DARPA, DOE, etc.), it's certainly possible to have enough months of grant support to buy out of teaching during the academic year.  Whether your program manager will agree to pay for this and whether your institution will allow it are still questions that you'd have to answer.