Why do many ram air inlets have this shape? I often see this particular shape for ram air inlets.

Here on an older 737


It's stretched on the newer 737's but still the same basic shape


A also see it a lot on cars.

1979 Camaro Z28


Lamborghini Countach


Is there some aerodynamic advantage to this shape, and if so why?
Those are called NACA inlets or NACA ducts. As wikipedia mentions:


  When properly implemented, a NACA duct allows air to flow into an internal duct, often for cooling purposes, with a minimal disturbance to the flow.


So yes, there is an aerodynamic advantage.
As for the "why", if you're in the mood, you can have a detailed look at the original report (I'm not able to properly summarize it).