This is quite normal, and is not a tax. Tourists entering Mexico are required to get an FMM tourist/visitor permit. The fee for this is $500 MX, and is payable if your stay is between 7 and 180 days. Less than 7 days there is no fee.
If you plan to leave and re-enter Mexico several times (in 180 days) you can ask for the FMM to be valid up to 180 days, you don’t need to repay each time you enter, as long as you have your valid FMM card with you passport. After 180 days you need to get another FMM. (This multiple-entry option might only be available in Baja though)
See Mexican Tourist Cards (FMM) for more info.
See also the FMM Online Application on the INM (Mexico Immigration) website – this page is the application form to buy one online, but also gives information about it in English.
Credit:stackoverflow.com‘