Yes, that's a thing.
You need a record of all transactions for tax purposes. If I give merchant a dollar, they give me a donut, and don't record the transaction, that's a crime - they're not paying sales tax/VAT on that, and also obtaining unrecorded tax that is used to pay "black salaries" in cash without paying the appropriate income & social security taxes.
The ritual of giving a receipt to you (and you putting it straight into the waste bin) visibly demonstrates that the business routinely creates the receipts for all (most?) purchases, it ensures that in the vast majority of cases the receipt actually gets produced, and if a business is routinely not producing these receipts (or having fake info in these receipts) then this would be clearly visible to the general public. This ritual has a certain social value in enforcing tax compliance, so that's why it's required despite the paper cost.