This system allowed unregulated state organisations and non-bank affiliates of banks and thrifts to originate thousands of risky mortgages and it allowed AIG to build a huge and essentially unregulated hedge fund on top of tightly regulated insurance companies .