Facebook (META -0.09%) and Apple (AAPL -1.92%) have a new trick up their proverbial sleeves and they hope it will help them attract and retain top talent. The tech giants are offering to pay up to $20,000 for female employees to freeze their eggs, according to NBC News. While this may be appealing to some career driven women, the costs can add up quickly for the tech firms. Consider this, Apple currently has around 98,000 employees many of whom are women. With Facebook and Apple now offering fertility perks, let's take a closer look at some of the other strange ways Silicon Valley's most popular companies attract top talent today.

Punching the biological time clock
Facebook and Apple want their employees to be able to focus on their careers without sacrificing the chance to start a family down the road. Sure, it is a bizarre perk, however, "about one-third of couples in which the woman is older than 35 years have fertility problems today," according to the CDC. Therefore, many women in high-power positions might find this benefit appealing.

This is particularly true considering the high cost of oocyte cryopreservation or egg freezing. The procedure, for example, typically costs around $10,000 for each round and an additional $500 annually to store the eggs, according to NBC.

An Apple spokesperson said, "We want to empower women at Apple to do the best work of their lives as they care for loved ones and raise their families." On top of paying its female employees to freeze their eggs, Apple also offers other fertility coverage and recently expanded its maternity leave policy.

The media was quick to mark this as controversial. However, it's important to remember that Apple and Facebook aren't requiring female employees to freeze their eggs; rather they are offering it as yet another worker benefit in hopes of retaining top talent.

Source: The Motley Fool.

Both companies also offer other interesting perks in hopes of attracting and keeping the country's brightest engineers. Facebook's campus, for example, is littered with communal beach cruiser bikes so employees can easily get around the 57-acre property. Hungry? Facebook's Epic Café provides three meals a day five days a week -- all free to employees. The property also includes a barbecue shack, Mexican restaurant, sushi joint, pizzeria and burger joint.

Facebook wants its employees to be proud of where they work. So what better way to achieve this than with a company store in which most of the thumbs-up swag is subsidized by corporate and sold at a steal to employees and their families. Other perks include a free candy shop loaded with frozen yogurt and sweets, free vending machines with Mac accessories for your computer or smartphone, and an on-site barbershop and video arcade.

Apple's Cupertino campus is no different. In addition to free food and compensation matching programs, the tech titan's on-site wellness center provides free care to employees with a massive team of doctors, chiropractors, physical therapists and dieticians -- with wait times, get this, of five minutes or less.

The price of employee happiness
Towers Watson, a corporate benefits consultant, estimates that tech firms such as Facebook and Apple will spend an average of $10,450 per employee this year. Moreover, in addition to the free perks discussed above, Facebook pays $3,000 in child care expenses per family and offers up to $5,000 per employee for adoption assistance, according to Forbes. The social network also doles out $4,000 of so-called "baby cash" for new parents to spend how they please. Meanwhile, in addition to egg freezing, Apple also offers fertility coverage of up to $15,000 to all of its employees including its part-time and retail workers.

Ultimately, these benefits should pay off for Facebook and Apple down the road because they encourage top performing employees to stick around for years on end. As a result, this helps reduce recruiting and hiring costs for the companies. And when you have tens of thousands of employees like Facebook and Apple do, it pays to keep them happy.