This is a complex question and it gets at the heart of the play. Willy Loman is a man driven by fantasies of great success and let down when those fantasies do not materialize. The question beneath your question here concerns Willy's role in the construction of his dream. Is he responsible for his fantasies or has he been duped into believing in false values, false dreams, and a false definition of success by his peers or his culture?
Considering the fact that Willy's neighbor Charley does not succumb to the same false set of ideas suggests that Willy is the arbiter of his fate and is responsible (through folly or weakness) for the outcome of his life that grows out of his addiction to fantasy.
Charley is a successful businessman, and is exasperated by Willy's lack of respect for him and his ideals, and by Willy's inability to separate reality and fantasy.
Charley serves as a counterpoint to Willy, a down-to-earth, practical man who achieves success through hard work. Willy's brother Ben is another successful figure. He, like Willy, was a dreamer, but his dreams come true because he does the work to make that happen. Willy, in contrast, simply talks about his dreams, talks about how to achieve success, and demonstrates a self-serving maleability of morals.
His flaws allow him to continually espouse virtues he does not possess. He is defeated, in the end, by these weaknesses, which lend reality to his false dreams.
Willy fails because he cannot stop living in a reality that does not exist, and which dooms him to fail in the reality that does exist.