Bank fees for merchant charges on credit cards are an expense to me but why does it show as a cost of goods sold?
Simple logic is its variable cost (aka direct cost). Merchant Fees are directly associated with generating revenue like material cost or direct labor cost. In theory, you would not have these merchant costs if you do not have revenue income whereas paying monthly rent or telephone bills are overhead expenses (or aka as indirect costs) and not (always) related to revenue or income. Furthermore, if the business is looking for more accurate gross profit from revenue, this is the way to go.
That’s the simple explanation. But many businesses still just like to treat Merchant Fees as overhead (indirect) expense.