How do government agencies allocate program resources? Some authors presume that agencies seek to maximize program objectives; others suggest agencies favor the districts important to the president’s election. In addition, agencies may distribute larger program resources to those districts whose congressional representatives are best positioned to help the agency. We examined how federal government agencies responded both to the 2006 election, when control of Congress shifted from the Republican to the Democratic Party, and to the 2010 election, when the House switched from Democratic to Republican control. We used a difference-in-difference analysis to evaluate the impact of each election on the agencies’ allocations of contracts. Agencies generally responded to the elections by allocating more contract resources to districts represented by the winning party. However, federal agencies reacted differently to changing political environments, depending on the characteristics of the agency. For example, after the 2006 election, those agencies with programs favored by Republican members of Congress allocated more resources to Democratic districts. These “Republican agencies” presumably are the most vulnerable to the risk of losing future appropriations. “Democratic agencies” (and “neutral agencies”), facing no significant threats to their appropriations, did not respond to the election as strongly. Finally, more vulnerable districts received the most support, especially by the “Republican agencies.” We reaffirmed these results by using the 2010 congressional elections, in which the political orientations of the districts favored with more contract distributions was reversed.