Bacteria lives on the outside of foods, especially raw meats. When you cook a steak, you kill the outside bacteria making it safe to eat the pink insides since it won't be exposed to any bacteria. Hamburgers however are made of ground meat which, since it's ground, has been exposed to more bacteria. The meat is packed in a hamburger patty, but the inside has still been exposed to bacteria. You fully cook hamburgers to kill any lingering bacteria inside and out of the patty.