When you use a program like FBI or BRM (and BBM/DevMenu) to install CIAs, they do so by telling the 3DS to perform the installation. This is also how the eShop installs titles. Basically, we are using Nintendo's installation process.
And if you had an NNID linked to the system when you installed the "legit" games, you cannot re-download them from the eShop once they are removed from the device*. You can re-download them if they were installed before linking an NNID as this would essentially be the same as buying a new bundle 3DS. Only, you know, with games that didn't actually come with your system. When you enter the eShop for the first time the preinstalled games are associated with your account. (Correct me if I'm wrong, guys)
*Got bored and actually tested this out a few times. Shows as "Downloaded" while installed, and "Tap to Purchase" after removed. I'm not going through the trouble of unlinking/relinking my NNID to test the other part of my explanation. lol