How are some coins premined? Did the developers of the various premined coins have to wait for those coins to be mined first or did they change the code to first issue themselves the premined coins?

I'm referring to the list of coins at http://altcoins.com/scamcoins
Both options are possible. I don't know how most scamcoins do it but I believe it's more common to actually mine coins before the chain is released to the public.