People's safety comes first. Not all bears represent the same level of threat. While grizzly bears are much more rare, they may be tempted by the same smells as black bears. Grizzly bears respond to threats much differently than black bears and can generally be considered more dangerous. This makes Grizzlies even less compatible with people and towns, and partially explains why the range of the North American Grizzly Bear has been shrinking over the last 150 years.
Bears take advantage of whatever food that is available in their home range.
They are attracted by sights, sounds, memories, and particularly smells. Bears can smell garbage from a mile away and if they are rewarded with an easy meal they learn very quickly to repeat behaviors. In effect we teach them to come into our towns. Wild bears normally have a fear of people. If they are allowed to forage for food near us, they can quickly become habituated to our presence and become more bold in their actions.