Hi there.
The cartridge you are talking about usually holds a micro-SD card, which you store DS ROMS on - basically the ROM is the game itself, without all the gubbins around it which you buy from a shop.
These cartidges aren't illegal and having ROMS isn't illegal, as long as they are only back-ups of games you have.....if you know what i mean.
For the purposes of staying legal, you are not allowed to have game ROMS of titles you dont own the hardcopy of.
Anyway, you can get these type of cartridges from various sites.
I have used these two in the past:
http://www.consoleup.com/shop/
http://www.model-gadget.com/shop/product_info. php?cPath=49&products_id=716
The one i bought was the M3DS Simply.....very easy to use.
Here is the M3DS website:
http://www.m3adapter.com/SLOT-1_Series_M3DS-S. htm
Hope this helps....