When Laszlo Bock joined Google to lead HR, the company offered new mothers 12 weeks paid time off.

Still, Bock observed a problematic trend. New mothers were leaving the company in droves. It was costing Google a lot of money.

So he instituted a new policy to help with retention: Five months maternity leave with full pay and full benefits. Attrition of new mothers dropped by 50 percent.

Google's generous family leave policy is just one of many benefits that make the tech firm such a desirable employer. But we all know Google-level perks are not the norm. Google is a workplace utopia compared to how some companies treat expecting and new mothers.

The New York Times recently explored pregnancy discrimination across several American companies. In some workplaces, being pregnant can derail a woman's career and hurt her earning potential. But having kids improves a man's earnings. Here's the most chilling statistic from the piece:

"Each child chops 4 percent off a woman's hourly wages, according to a 2014 analysis by a sociologist at the University of Massachusetts, Amherst. Men's earnings increase by 6 percent when they become fathers, after controlling for experience, education, marital status and hours worked."

New York Times said they reviewed thousands of court and public records and interviewed dozens of women, lawyers and government officials. From corporate America to hourly employees, they found that pregnancy discrimination is rampant at some of the nation's largest companies.

The piece included stories from a woman who was a vice president at pharmaceutical company Merck, another who worked at international trading company Glencore and two others who worked at Walmart.

Even though the Merck VP was one of the company's top vaccine salespeople, she was laid off a few weeks before her due date. When she was pregnant with her child, the Glencore employee said her boss told her having kids would plateau her career. When pregnant with her second child, she approached her boss about her future at Glencore. According to her, the boss told her she had nowhere to go because she was old and having babies.

The Walmart employees were denied reasonable accommodations for their pregnancies. One was expected to still lift heavy items even though she asked not to. Another had to continue to work with cleaning chemicals that made her physically sick and that her doctor told her could harm her baby.

More subtle forms of discrimination abound

The experiences of these women are extreme, but real. Many other pregnant women experience more subtle and sometimes awkward forms of discrimination at work.

Take mother's rooms for example. You know how everyone's eager to knock down walls and go all-in on the open floor plans? A mother's room is rarely part of those design plans. While there may be meeting rooms for private conversations, the trend is moving towards floor-to-ceiling glass meeting rooms that offer no privacy.

This leaves nowhere for nursing mothers to pump -- except maybe the bathroom or a storage closet.

Pregnant women are also perceived as being less committed to their jobs. Which simply isn't true.

"Put yourself in your pregnant employee's shoes (with swollen ankles) for a moment," urges Romy Newman, the co-founder of Fairygodboss, whose mission is to make workplaces better for women.

"If she has a job she loves and derives satisfaction from, it's unlikely that she is going to suddenly feel differently because she is expecting," Newman explains. "Her pregnancy is not a betrayal of her work-life, and it's critical that you not treat it as one."

The real cost of not having parental leave

The United States is the only developed country that doesn't require paid parental leave. So many companies don't.

Doing so is good place to start. Yes, these policies are expensive. But it could be even more expensive not to.

Take TD Bank, for example. Last year, the bank that employs over 26,000 employees rolled out an expensive and generous policy: 16 weeks of paid leave to all parents welcoming a new child, by birth or by adoption. All employees who have been with the company for more than a year and work at least 20 hours a week are eligible.

Beth Webster, who leads HR at TD Bank, said she believes employee engagement drives better customer service. What's more, not offering maternity leave could cost the company big time. "If turnover numbers are going up, it's a huge cost to the company -- not just in administration, but in customer satisfaction," Webster said in an interview last year.

Winning the talent wars

Google started offering five months maternity leave to tackle employee retention. Such policies are great for attracting top talent, too.

A global Ernst & Young survey of 9,700 people found that millennials value parental leave more than previous generations. Of the American millennials surveyed, 83 percent said they would be more likely to join a company offering these benefits. Ernst & Young took note. The professional services firm extended their parental leave policy from six weeks to 16 weeks in 2016.

If you're concerned with not being terrible to your pregnant employees and new parents, here's another idea: Talk to them. Ask them what accommodations they need, or which benefits they desire most. Listen to what they say. Then make some changes.