Mexico has a tourist fee they charge visitors. If you are either staying in Mexico longer than 72 hours or traveling past the Border Zone you will need to pay the 190 peso Tourist Card fee (roughly $20 US dollars). The card, known as the Migratory Tourist Form (FMT) is valid for six months (180 days) with multiple entries. Make sure you ask for the full 180 days even is you plan to stay only a short time. You never know if you may return in those 180 days.
In Baja California, the border zone has been extended to San Quintin, on the Pacific side and San Felipe, on the Sea of Cortez. Sonora state is in the process of extending it's border zone too. In mainland states along the border, this includes a 16-20 mile zone south of the border. Some areas have "tourist corridors" such as Baja, please check with the Mexican Consulate in your area.
According to the law you must have the Tourist Card on you while traveling (make a copy if possible in case original is lost). You can pick up a card at the border, just stop at immigration as you cross into Mexico, parking is available. You must have either a current passport or original birth certificate with current ID. Baja California and Sonora sometimes only require a current ID, but it's wise to check with the consulate first.
Some insurance companies and travel clubs may be allowed to issue Tourist Cards in the U.S., please check with them first.
Immigration will not take money for the card, you must go to a bank (there is usually one next to Customs). You can also pay the fee at any bank in Mexico, where upon they will stamp your Tourist Card paid. You must then go back to immigration, or the next immigration office in the next town you visit, and have them stamp your card as valid. Make sure you do this right away, do not wait until your trip is half over. Your best bet is to take care of all of this at the border.
NOTE: If you are arriving by airline or cruise, your Tourist Card fee will be charged in the cost of your package or fare, and they will give you your tourist card to fill out for Customs when you land.