I am sorry about your predicament. I understand your situation - completely, if that is possible. I, too, have had a brief affair, and now in a limbo between being "friends" with him after the affair.
That little voice that is telling you that he's only being nice because he's sorry for what he's done to you - listen to it! That is the truth. He is not going to leave his wife for you. I've read somewhere that men decide whether a woman is suitable to be their wife in the first 15 minutes of meeting her. He's already decided that you are not "it".
Sometimes, we just have to know when to let go. We can't get everything we want - even if there are not many things that we actually want!
As for the friendship, I think it's a superficial attempt to "be nice". He will not think of you as a friend because he's already seen a side of you that "friends" normally do not see.
The only way to redeem your dignity now is to walk away - with your head high, and smiling. Bring out the best of you and be successful. When judgement day comes (ie. you meet again by chance), well, you know the rest.
Play your cards right, and this affair could be the best thing that happened to you.