Massachusetts Secretary of State William F. Galvin announced Thursday he will file legislation barring banks from holding deposits from state entities if they do not offer a basic, free checking account.

The proposed bill comes on the same day as reports said Bank of America (NYSE: BAC) is testing out new bank fees for certain categories of checking account customers.

“These reported fees constitute a burden on many bank customers, in particular the elderly and the young, especially in these days when banks offer little or no interest on deposits,” Galvin said in a statement. “I am filing legislation that will bar banks from holding state deposits if they do not offer such customers basic checking account without fee.”

It's undetermined when the legislation might be filed, Galvin spokesman Brian McNiff said. The proposed law refers to deposits from government entities, such as the Registry of Motor Vehicles, which collect revenue from fees and put those deposits into banks. It would not cover private deposits from consumers.

Checking account customers at Bank of America could be hit with fees if they don't meet certain conditions, like banking online, buying more products or maintaining balances, according to a Wall Street Journal report on Thursday.

"As we do now, any future offering will offer ways for customers to avoid fees," BofA spokeswoman Ann Pace told the Boston Business Journal.

"We have made no decisions on the construct of our new product offerings," Pace said. "We have been testing in select markets for more than a year and plan to continue to learn from those tests before we make any final decisions. Our primary objective is to give our customer more reasons to do more business with us. Whatever we decide will be done with that core principle in our mind. When we do finalize our plans, we will communicate with our customers and be in line with the industry."

The move by BofA, the state's largest bank by assets, comes amid competition from J.P. Morgan Chase & Co. (NYSE: JPM) and Wells Fargo & Co. (NYSE: WFC), which have similar plans.

In Massachusetts, where the bank had $70.9 billion in assets in 2011, the "Essentials" checking account, BofA's cheapest checking account on offer, has a flat $6 fee. Adding a companion savings account costs an additional $5 a month unless customers maintain a minimum $300 daily balance or set up a direct deposit of at least $25 a month into a checking or savings account.

McNiff said the proposed legislation would not exempt banks that offer free checking accounts with conditions attached, such as minimum balances.

The "Essentials" account also requires you to answer questions about your occupation and employment status, including the employer name and work phone number, because, "for us to process your application, we need to know certain information about your current employment and income," according to BofA's web application. Customers also need to provide an email address along with home address, phone number, social security number and U.S. citizenship information.

BofA's plan to charge customers a $5 monthly fee for debit card use fizzled in late 2011 as users protested, threatening to switch or even switching to credit unions or small banks in protest, and the company was harshly criticized for not doing sufficient market research before introducing the plan.