What purpose does the character of Uncle Ben have in the story?
The Uncle Ben character has several functions in the play. He serves the practical function of demonstrating Willy's dementia and of offering a means of background exposition for Willy's character. Also, the scenes with Uncle Ben help to articulate the nature of Willy's ambition and disappointment.
Willy initially refers to Uncle Ben after an episode in Act I where Willy has been engaged in a delusion/memory of finding out that Biff was flunking math and stealing. When brought back to the present moment by Happy, Willy expresses his regrets at having not followed Ben to Alaska.
"Why didn't I go to Alaska with my brother Ben that time! Ben! That man was a genius, that man was success incarnate! What a mistake! He begged me to go."
An idea is conveyed here that Willy feels will never measure up to his own standards of success (symbolized by the excessive success of his brother Ben). He has made mistakes and poor decisions. Ben, on the contrary, made bold decisions and was rewarded for them with "diamond mines."
Importantly, Uncle Ben appears only as a false image. In the action of the play Ben is a figment of Willy's imagination/memory. He is not real as the other characters are. Uncle Ben is, instead, a fantasy for Willy and so can be seen as Willy's fantasy of success. The fact that Willy is "haunted" in a way by Uncle Ben is suggestive of Willy's relationship to his failed ambitions. As much as he is haunted by the figment of his older brother, Willy is also unable to escape his thoughts of what he could have been in the world (and what he ended up being - a failure in his own eyes).
The fact that Uncle Ben's success is strongly associated with material wealth is also quite important, but we should also note that Ben is not described as having a family. Ben's success appears to be entirely individual. The significance of this idea can perhaps be best seen in the light of Linda's insistence that Willy is not a failure.
For the play's audience, there are at least two ways available to understand Willy Loman in the context of success. One way is to see Willy as a moral failure who made mistakes that he ran away from and who continues to choose against facing up to his own defects honestly. Another way to see Willy is to recognize that Willy not only refuses to see his flaws clearly but he fails also to see his achievements.
When the play opens, Willy and Linda are set to make the final payment on their house - a standard symbolic moment representing the achievement of the "American Dream" of property ownership. The couple have raised two children to adulthood. One child, Biff, ultimately proves himself capable of self-knowledge and of compassion (he is a good person in the end).
These examples of success do not appear to Willy as "true" marks of achievement. He denies their worth and his own just as he denies his failings. So, again, we can see that illusory nature of the Uncle Ben character as a symptom and symbol of the nature of Willy's ambition, which is ineluctably tied to a very specific and far-fetched kind of success.
Ben's character also creates the opportunity for the play to explore Willy's childhood where is it revealed that Willy never really knew his own father. As Arthur Miller's penchant for occasional Freudianism might suggest, Willy's personal family history may help to explain his issues with Biff. Never having had a father, Willy worries that he is failing to "do it right" as a father and so cannot overcome a deeply nagging doubt about his value in that role.
Without Uncle Ben to talk to, Willy's childhood would have no other apparent opportunity for discussion in the play.
Uncle Ben acts as Willy's foil. In Willy's mind, Ben is everything Willy is not and hopes to be: successful, bold, "well liked." Ben only appears in Willy's imaginative ramblings.
Willy also wants to be the kind of father his son's can look up to: stong, wealthy, and competent. Ben fits this bill. In Willy's mind, he hears Ben brag: "William, when I walked into the jungle, I was seventeen. When I walked out I was twenty-one. And, by God, I was rich!" Willy bellows back: "That's just the spirit I want to imbue them with! To walk into a jungle!"