Dark funding, start up funds, shell companies, etc.
They are not the only ones.
https://qz.com/1145669/googles-true-origin-partly-lies-in-cia-and-nsa-research-grants-for-mass-surveillance/
Read this and you'll learn a bit more about what is happening in tech valley.