Recommendation letter for a good student that you don't know? Let say you a professor and there are lots of students, say 100 in your course. After the exam, a student whose final mark is, say 85/100, sends you an email to ask you for a recommendation letter. Assuming that you don't know him, or just remember that he went to your lecture some times (of course you can check his mark). Will you write a recommendation letter for him?
As ff524 said, if the professor has only the grade to go on, there is little to write an recommendation letter about. The only situation I an think of where this would be very relevant is:


if the course is an essential test for further studies. Doing an American undergraduate with a mathematics major might only have a few courses that are really challenging your abstract thinking skills. Doing well in those courses might be a good predictor of doing well in further studies.  
there were other students that got similar scores in that course and went on to do well in further studies. Best case scenario: last year the same university accepted a student who got an 80-84 in this course.


So both the course needs to be very relevant for the further studies you are considering and the grade itself should be high enough as to clearly predict success in those further studies. If either is not the case (the course is one of many, or your grade is just not exceptional), the professor simply can't write a good recommendation letter, regardless of how willing (s)he would be.