Well since I live in Maryland and also buy guns in Maryland, I think I can answer this the best.
You have to be 18 years old to buy a rifle or shotgun in the state of Maryland. No special license is needed to buy a shotgun or rifle in Maryland. You will need to present your driver's license and one other form of identification with your address on it, and complete the standard ATF form 4473 when making the purchase. The retailer will then do a background check using their phone to confirm that you are able to purchase/own a rifle or shotgun.
For handguns, you must be 21 years old or older. You must also have a "purchasers card" to buy a handgun in Maryland. In order to get such a card/certificate, you must first watch a 30 minute video presented by the Maryland State Police that discusses handgun safety. There is NO test given after viewing the video. All you need to do is be present while the video is playing...and you will be issued a card (by someone trained to show the video and give the cards). It's kind of crazy, but that's how it works. Handguns and certain assault rifles are considered "restricted firearms", requiring you to have the purchasers card before you can buy them.