In the countries that I am familiar with (such as Canada), using barter to avoid taxes is definitely illegal. You are required to report the dollar value of the exchange as revenue. It is treated as an implicit trade of cash along with the trade of goods. Since I am not going to give tax advice to random strangers on the internet, please consult the tax laws of your jurisdiction.

Canada Revenue Agency guidance on barter: [link to CRA page][1]

There are exemptions, such as for little kids trading cards on the playground. The idea is that you cannot be earning a livelihood.

The authorities can detect this activity the same ways that they can detect people working for cash. It’s not easy, but it can be done. They can have undercover agents, get tips from whistleblowers (e.g., a bitter divorce), or just show that a person is living a lifestyle that is not in line with their declared income.


  [1]: https://www.canada.ca/en/revenue-agency/services/forms-publications/publications/it490/archived-barter-transactions.html