Travis Dodson, Josh Pauls and David Eustace also scored for the United States, which claimed a fifth championship title and ninth medal. Jack Wallace was a partner in three goals.
Billy Bridges was the only top scorer for Canada, which defeated the Americans 2-1 in the preliminary matches.
It was the replay of the 2019 final, which the United States won 3-2 in overtime. The 2020 tournament has been canceled due to the COVID-19 pandemic.
Earlier on Saturday, Russia crushed South Korea 7-0 to win the bronze medal.
The top five teams in the tournament qualified for the 2022 Beijing Paralympic Games. The Czech Republic beat Norway 2-1 on Friday to finish fifth.
Farmer opened the scoring at 7:28 in the first round in the power game. Dodson doubled the mark after a few minutes.
Bridges closed the lead 2-1 with less than a minute left in the first half.
Paul also took advantage of the power play in the second period to get the Americans back to top two. Farmer added a goal in the final moments of the clash.
Eustace sealed the match result in the last twenties.
“Alcohol scholar. Twitter lover. Zombieaholic. Hipster-friendly coffee fanatic.”