Actually whether the tax debt is secured can matter a great deal in bankruptcy. I’ll give you two examples.
First, suppose the tax obligation is indeed dischargeable. If the tax obligation is dischargeable, then it is a general unsecured debt, pretty much the lowest priority for payment in bankruptcy, unless the IRS had properly secured its interest prior to the bankruptcy filing by filing a notice of federal tax lien. Like any other creditor, have a secured interest bumps up its priority with respect to the non exempt assets to which the lien attaches. The tax agency will be able to collect its share of the proceeds on the sale of those assets. The secured lien interest can also survive with respect to exempt or abandoned assets, giving the agency an opportunity to collect from those assets even after the bankruptcy is over.
Second, assume the tax obligations are not dischargeable. If the tax agency has a secured interest in nonexempt assets sold by the bankruptcy trustee, the agency will get paid its share of the proceeds from the sale of that asset, allowing it to collect sooner than it might otherwise if the tax was not secured.
These reasons, among others, were why the IRS emphasized the importance of revenue officers and ACS filing the notice of federal tax lien as early as possible when I worked at the IRS. It can make a considerable difference in the government’s ability to collect.
If the trustee claims the tax refund on behalf of the bankrupt estate, the refund will be distributed to creditors based on their priority in the bankruptcy. It would not necessarily go to the tax agency to pay the debt owed to it. Note that generally speaking, in a Chapter 7 bankruptcy the trustee may only claim refunds due the taxpayer for tax periods prior to the filing of the bankruptcy petition. If the petition is filed in the middle of the year, the trustee may claim the share of the refund for that year which is allocated to the part of the year prior to the bankruptcy filing.

