The key to whether or not two trademarks can peacefully coexist is whether there exists a "substantial likelihood of confusion" between the marks. Thus, McDonald's hamburgers would not likely be confused with Old McDonald's Farm, or McDonald's Shoes (home of the golden arches?).
The problem with this is that there is frequent overlap in the products or services offered by companies with pre-existing trademarks. Coca Cola is a provider of carbonated beverages, but also T-shirts, clothing, and a host of related accessories. Thus, trademarks that dont infringe now may infringe later on. Okay. Law School lesson over. Let's look at how this impacts the iPhone.
On March 20, 1996, a small California company called Infogear registered the mark "iPhone" with the USPTO. The company made products to allow people to connect to the internet without a computer, but apparently never made or marketed a product that they called iPhone. Infogear was aquired in 2000 by Cisco Systems, who obtained, among other things, the rights to the iPhone trademark. This points out the importance of actually registering a trademark in increasing the value of your company.
In about 2004, Cisco's Linksys division began to actually make an iPhone product – essentially a phone connected to its router to allow for easier VoIP telephony. The Cisco/Linksys iPhone apparently stood for "Internet Phone".
Now, Cisco wasn't the only one to use or register the mark iPhone for VoIP products. In March 1995, California company Teledex registered the iPhone mark to describe a, "telephone that integrates a display and interactive abilities with an IP-based network to deliver both voice communication and graphic-based content and services to hotel guestrooms".
British company Orate Telecommunications Services also offers a VoIP phone called an iPhone. Other companies have applied for US trademarks using iPhone, but later abandoned them, including the NY-based XTreme Mobile in March 2005, the California-based SFMobile in October of 2003, a guy named Ravi Lahote in February of 2000, and a guy named Stephen Page in Pleasanton, California in April of 1994.
In fact, in May 1997, a California company called Cidco applied for a trademark in iPhone for "communications terminals comprising computer hardware and software providing integrated telephone, data communications and personal computer functions". Sounds a bit like the Apple product, but not much. Confused?