Since the beginning of last year, Mr. Obama and the Democrats have burned through millions of dollars to find and register voters. They have spent almost $50 million subsidizing Democratic state parties to hire workers, pay for cellphones and update voter lists. They have spent tens of millions of dollars on polling, online advertising and software development to turn Mr. Obama’s fallow volunteers corps into a grass-roots army.

The price tag: about $400 million from the beginning of last year to June 30 this year, according to a New York Times analysis of Federal Election Commission records, including $86 million on advertising.

But now Mr. Obama’s big-dollar bet is being tested. With less than a month to go before the national party conventions begin, the president’s once commanding cash advantage has evaporated, leaving Mitt Romney and the Republican National Committee with about $25 million more cash on hand than the Democrats as of the beginning of July.