For some reason lately I have been caught a few times doing minor things such as breaking into houses etc. then the guard comes up to me and says we're friends I'll take care of that fine for you. My question is how did this come to be?
A disposition of 90 or higher does this. To get the disposition up that high, play the speechcraft game with your weapon drawn. You'll probably be able to get the disposition up to around 85 (depends on your speechcraft rating). Then put your wep away and talk to the guard again. You'll see that the disposition is now 95.
If you've got a high fame and haven't done too much of the Thieves Guild quests, you can get get a pretty high disposition with guards even without using speechcraft.
One of my friends was usiing the console to set things as his ownership, and I think one time he had nothing selected as he typed in the command . . . so all NPCs had a disposition of 100 torwards him