I live in Michigan and recently went to this new local bar where I was charged tax on my $3 beer. So total was $3.18. Is that illegal
Yes, that would be legal, indeed required
According to the Michigan Dept of the Treasury:
Individuals or businesses that sell tangible personal property to the final consumer are required to remit a 6% sales tax on the total price (including shipping and handling charges) of their taxable retail sales to the State of Michigan. Sales of electricity, natural or artificial gas and home heating fuels for residential use are taxed at a 4% rate. Michigan does not allow city or local units to impose sales tax.
According to the official Michigan State Sales Tax Handbook
Groceries and Prescription Drugs are exempt from sales tax, but prepared food is not. This includes restaurant food, and would, I think, include drinks served in a bar. When I worked in a Michigan restaurant and bar about 40 years ago, sales tax was charged, to the best of my memory.