With the ongoing difficulties companies are having hiring tech talent, Facebook (META -0.28%) and Google (GOOGL 1.08%) are giving themselves a leg up on the competition by being great places to intern.

According to a survey released by Glassdoor on Feb. 13, the two tech giants lead the top 25 highest-rated companies hiring interns. The rankings were compiled by Glassdoor from the thousands of reviews interns from the 4,700 U.S. companies it estimates hire interns posted on its site.

The ranking may be more than just an accolade for Facebook and Google as, given the shortage of available tech talent -- specifically developers -- having interns who want to become employees is a major competitive advantage.

The market, especially for developers, is tight

The value of retaining interns may be at an all-time high. In its January 2014 report, Dice, a hiring website for tech jobs that tracks how difficult it is to make tech hires, found that among the hardest places to hire tech help are the cities where the biggest technology companies are based. Those cities, of course, always have the highest demand, but they also have the highest concentration of talent.

According to Dice's report, "New York City came in at number one as the toughest tech city to recruit in. According to former Mayor Bloomberg's "Made in New York" map, nearly 1,500 New York City tech companies are currently hiring and on Dice there are more than 8,000 positions advertised on any given day that are based in this city."

San Francisco takes second place as the toughest place to recruit in as social media and big data become more mission-critical for businesses. The other notable West Coast city to crack the top 12 was Seattle, which houses both Amazon.com (AMZN 0.58%) and Microsoft (MSFT -0.18%).

Microsoft came in #7 on Glassdoor's list and Amazon was #25. So, while Facebook and Google might have an advantage in retaining interns as employees, it's not like its biggest competitors for tech talent are scoring poorly with their interns

One company makes an extreme offer

Hubspot, a Boston-based inbound marketing software company, announced last May that it would pay $30,000 to anyone who refers a developer or designer to the company. The $30,000 fee, the company said in a press release, will be paid to the referring individual after a candidate is hired by HubSpot, and applies only to software engineers and designers working on the product team.

"At HubSpot, we're disrupting the marketing industry and building a next-generation company, so it's imperative that the software engineers and designers we add to the team are incredibly smart, innovative, agile, and passionate about the work we are doing," HubSpot's Chief Product Officer David Cancel said when the offer was announced. " We believe that you're defined by the company you keep, so the $30,000 referral bonus is our way of thanking people worldwide for bringing us the best and brightest developers in the industry to join HubSpot."

Happy interns, happy life?

With it being so hard for tech companies to hire qualified people, internships can also save companies from making a bad hire. An internship allows an employee who might be a hot commodity on the job market a way to test out a potential employer, and it's also a way for the employer to test the employee. In some cases, good people and good companies are just not the right match.

Fred Yager wrote an article for Dice where he cited The Harvard Business Review's stat that "as much as 80% of employee turnover is due to bad hiring decisions." The cost of those poor decisions can be staggering.

"Recruiters I spoke with said that if you make a mistake in hiring and you recognize and rectify the mistake within six months, the cost of replacing that employee is still going to cost you two and one-half times the person's salary," Yager wrote. "That means a poor hiring decision for a candidate earning $100,000 per year could cost, on average, $250,000, and that expense comes right off the bottom line."

And while there is no guarantee that an intern's performance is truly indicative of how the person will perform as an employee, it's essentially an extended test drive. That opportunity should make it easier for Facebook, Google, and others on the top 25 to retain top talent long after their internships end.