Advice from Google's Matt Cutts answers the question "Can I buy a domain that used to have spam on it and still rank?": Don’t Be The Sucker That Buys The Spammy Domain
Matt explains that there can be two penalties here, one on the manual side and one on the algorithmic side. If this was a manual penalty, you can fix the spam and submit a reconsideration request. Manual spam also has a time out, where the penalty will auto-expire if the spam is cleaned up. If it was an algorithmic penalty, then you need to wait until the algorithm picks up on the changes.
Plus, if the spam was very aggressive, it would be much harder to recover from that penalty without going through all the spam and cleaning it all up.
Matt said it is not impossible, but he equates it to starting with a negative ranking, like digging yourself into a hole and then starting from below ground to just get back to ground level. But it is possible, but you would need to document the steps you took in detail when you submit a reconsideration request.
In this case, Matt said he would probably not buy the domain name. He would probably pass on this specific domain and probably start with a clean and fresh domain.
Link to Matt Cutt's full video