You have to spend money to make money.

That's why California is making a $187 million investment in the 2020 census with the aim of protecting two things — political representation and its massive economy.

The unprecedented sum was allocated by state lawmakers because California could risk losing one of the 53 seats in its largest-in-the-nation congressional delegation due to a feared undercount, not to mention possibly missing out on hundreds of millions of dollars in federal aid.

While in an economic crisis before the last census, the state budgeted only $2 million to aid in the count, and in 2000, it spent just $25 million for that purpose, according to the state Legislative Analyst's Office. But this time is different, say advocates who are working to ensure an accurate count.

“At the end of the day, it’s about money and power," said Diana Crofts-Pelayo, communications chief for the California Complete Count Committee, an advisory panel that handles education and outreach for the upcoming count. “This is oftentimes more important than voting.”

Conducted every 10 years, the census is constitutionally required. The results determine the number of seats in the House of Representatives each state gets — and by extension its Electoral College votes — and impacts the dispersal of billions of federal dollars, among other things.

The confusion, fear and uncertainty generated by failed efforts of the Trump administration to add a citizenship question to the 2020 census, as well as the Census Bureau's host of preparedness problems, have prompted states, cities and nonprofits to take matters into their own hands to avoid a decade-long mistake. After the last census, for instance, more than 200 jurisdictions around the country challenged federal census figures.

The Trump administration in March 2018 announced its plan to add the citizenship question, which set off a flurry of lawsuits arguing the question would depress responses in places with large immigrant populations, mostly in blue states. Critics said this would cause the census to run afoul of the "constitutional requirement" that the government count all people living in the country, whether citizens or not. Although the Supreme Court blocked efforts to add the question and the administration has largely abandoned its plan to add it by executive order, many advocates say the damage is already done.

Every state is at risk of an undercount, but it is more pronounced in states with larger immigrant populations, according to the nonprofit Population Reference Bureau.

Carlyn Cowen is a policy expert at the New York-based Chinese-American Planning Council, which is doing census outreach to immigrant communities in the city and has worked on previous decennial counts. She told NBC News that there have always been undercount fears because of the massive undertaking of counting every person the country, particularly harder-to-count groups such as immigrants and people of color. But this year, residents have expressed a notable fear that completing the census could jeopardize their immigration status.

"This census is just particularly difficult because you're layering all of the immigration rhetoric of top it, which creates layers of fear and distrust," Cowen said. "That distrust still exists even though the question is not going to be on the census."

Arab-American men exiting a mosque following Friday prayers take fliers encouraging the arab population to fill out their 2010 census forms in Brooklyn, New York on April 9, 2010. Robert Nickelsberg / Getty Images file

The Census Bureau has assured critics it is "on track, on budget and on time" for Census Day on April 1 of next year — the official start of the count. The 2020 census population count is expected to cost the federal government $15.6 billion — 25 percent more than the bureau's estimate and three times more than the 2000 census. To make the process simpler, the federal agency is modernizing its efforts, including making the census forms available online and creating call centers to help people fill out the questions. Still, the Government Accountability Office placed the 2020 census on its list of "high-risk" government projects.

Twenty-three states have put millions toward backstopping federal efforts, but none come close to California's $187 million. Illinois has allocated about $30 million, New York, $20 million and Washington state, $15 million, according to the National Conference of State Legislatures. Other states have earmarked less than $10 million each for the effort.

Even cities have stepped up. In New York City, for example, they're not relying on the federal government's assurances. For the first time, the city earmarked $40 million to make sure every resident is counted for the same reasons as California. The city is dolling out chunks of that to groups like the Chinese-American Planning Council to do a host of outreach activities, including door-knocking, advertising and holding workshops with residents.

"We have been dealt an unprecedented and not favorable hand," Julie Menin, the city's census director, told NBC News. "In a city like New York City that has 3.2 million immigrants, the fact that the Trump administration tried unsuccessfully to add a citizenship question caused fear and intimidation, as was intended, in immigrant communities."

"We have to now undo all the damage that was wrought by the Trump administration," Menin added.

Director of the Census for New York City Julie Menin speaks to reporters outside of the US Supreme Court on April 23, 2019. From left are: Rep. Carolyn Maloney, D-NY, ACLU's Voting Rights Project Director Dale Ho, Menin, and New York Attorney General Letitia James. Mandel Ngan / AFP - Getty Images file

Nearly 300 federal programs use census data to divvy up hundreds of billions a year to states, cities and counties, according to a recent study by the George Washington Institute of Public Policy, money that goes toward everything from health care, to infrastructure, to schools. However, a study released by the Urban Institute in June found that more than 4 million people — particularly black and Latino Americans — are at risk of not being counted in the 2020 census, putting resources in jeopardy for those communities.

Both California and New York are re-allocating much of their census budgets toward outreach to harder-to-count populations, such as immigrant and minority communities, as well as seniors and children under the age of 5, by partnering with community organizations. Efforts also include media campaigns to reach people through print, digital and TV ads and the creation of census centers in libraries and other public spaces to help residents understand how to fill out the form and understand what's at stake.

Crofts-Pelayo said cities and states have always had an involved role in the census, but this year the count turned into a partisan issue over the proposed citizenship question, underscoring the need for California's nearly $200 million war chest.

"If there is an undercount, of those who were uncounted, it will cost the state $1,000 every year [per person undercounted] for the next 10 years," she said. “There was a heavily politicized environment this time, and it helped that we were in good economic times."

Volunteers count homeless people on a dark street on Skid Row during the 2015 Greater Los Angeles Homeless Count conducted by the Los Angeles Homeless Services Authority (LAHSA) in Los Angeles on Jan. 29, 2015. David McNew / Getty Images file

However, experts note that while the urgency to have an accurate census is there in some states and cities, the money isn't.

Oklahoma, for instance, where each person counted brings in an estimated $1,600-plus a year for 10 years, has not allocated money toward the census count, raising fears of negative consequences among advocates.

Joe Dorman, a former Oklahoma state representative and CEO of the Oklahoma Institute for Child Advocacy, told NBC News that the state has a history of undercounts, and having no state dollars forcounting its residents could put the state in a financial crunch.

"Those individuals, when they don't fill out the census, because of the loss of revenue, they inadvertently are forcing tax increases," he said, noting that since census counts are tied to funding social services, states would potentially raise taxes to close a likely gap due to an undercount. “I worry we have not invested the public dollars as the other states and that we aren’t going to see an improvement."

He said his organization has partnered with dozens of other nonprofits in the state to pool together resources and money to do outreach to the hardest citizens to count, which are often immigrant, rural or tribal communities as well as those who are skeptical of giving the government personal data. But children under 5, he said, are the most at risk of an undercount.

Democratic nominee for Oklahoma Governor, Representative Joe Dorman, speaks to a room of supporters in Oklahoma City after losing to Republican Mary Fallin on Nov. 4, 2014. Alonzo Adams / AP file

For instance, nearly 1 million children were left out of the 2010 census and as a result, states missed out on at least $550 million a year in various federal funds, according to research by Count All Kids, a census advocacy group.

Texas is another populous state with a growing Latino and immigrant population and a patchwork of efforts to ensure an accurate count, and experts are warning of dire consequences from this census. The state has a Latino population of nearly 11.4 million and, according to the Pew Research Center, an undocumented population of 1.6 million.

Like Oklahoma, the state has not allocated money to help in the count, and roughly 7 million Texans live in hard-to-count neighborhoods, according to state data. Also, this is the first time a census will be online, but a significant percentage of Texans, mostly in more rural areas, have little to no high-speed internet connection — the same as with in rural areas in other states.

“Because of that, we are very concerned that Texas going to be left behind in the census count,” Luis Figueroa, the legislative and policy director for the Texas-based Center for Public Priorities, told NBC News. He noted that an undercount by even 1 percent in Texas could result in a loss of up to $300 million a year in federal dollars. “The stakes are just too high," he said.

Under a perfect scenario, Texas could gain three House seats — and also three Electoral College votes — according to projected census data. However, experts and academics have noted to varying degrees that a significant depression in immigrant and undocumented responses could make Texas lose political power.

Some cities, such as Dallas and El Paso, have stepped up the census efforts, Figueroa said, But in places such as Fort Worth and other smaller and rural parts of the state, nonprofits are trying to backstop federal efforts with philanthropy dollars and their own budgets, as well as by rallying local leaders to encourage people to fill out the census.

"There is a heightened need and heightened urgency this time around," he said.