The way male characters would act as a foil to Willy Loman is by showing direct and indirect characterization traits that highly contrast with Willy's own traits.
The character that is most salient as a foil to Willy is Charley. Willy's neighbor and friend is also his exact opposite. While Willy loses himself in a self-made credo that measures life according to looks and popularity, Charley chooses to live his life prudently focusing on his son, Bernard, and just making the best out of what he has.
While Willy tries to emulate the life of Dave Singleman, the legendary salesman whose funeral was attended by everyone, Charley continues to live his own life as a family man and hard worker. There were no false pretenses nor hopes of grandeur in Charley's life, and these qualities made him a laughing stock in the eyes of the Loman men. They said that he wasn't well-liked, that Bernard was a nerd, and that they lacked the drive that the Lomans had, which will one day will make them all successful. As we know, that was all a fantasy. It was a huge blow for Willy having to admit that Charley was, after all, the bigger and better man. It was harder still to admit that Bernard, Charley's son, had easily made a name for himself through hard work and without the pretenses that Willy had taught his sons to live by.
Willy's brother, Ben, is also a foil that brings out Willy's fears and weaknesses. Ben is stronger, more audacious, more courageous, and slightly more grounded than Willy. All these are evident in that Ben made the move to leave everything behind (even younger brother Willy) to chase after his dream of becoming rich. Moreover, Ben openly criticizes Willy (in turn, Willy criticizes everyone else), and actually achieves a lot in life. Willy would confess in his hallucinations of Ben that he has fears that Ben never had, that he wishes he had gone with Ben, and that he regrets not having the courage to make the move. All of these facts reflect the weaknesses in Willy's character.
Willy's boss, Howard Wagner, is another foil to Willy in terms of being a father and family man. While playing a voice recording of one of his children for Willy, Wagner brings out the tender side of parenthood that Willy gave up in order to go chase after the quick money chances that he would get as a "famous" salesman. Wagner's character, although self-absorbed and brash, still possesses the redeeming quality that he is a better father to his kids than Willy was to his sons.
Finally, Bernard, Charley's son, could also be considered as a foil to Willy in the way that he demonstrates to be more grounded and mature than the much older salesman. He is even able to pinpoint the moment in time when Biff seems to have lost all interest in life, and gives up every chance to make it. It is then when Willy recognizes his own part in Biff's fails and sees that it is he who led his sons to chase a dream that was never there.