As a part of the Federal Reserve system, I believe they are obligated to cash Federal checks regardless. (I am open to having my ignorance fought on this point, however).
BofA would not cash my step daughter’s income tax return check even though her mother and I have an account. We were able to deposit the check in our account then make a withdrawl for the amount of the check.
It’s up to the specific bank’s policy. I’ve worked for several banks (never BoA); where one allowed you to cash government checks without an account, another did not.
Just call your local BoA branch and they’ll tell you.