The B-18 didn't actually beat the Boeing 299 - the 299 was dropped from the competition when the air force crashed the prototype before completing all the tests. To better control the possible back-room deals, Congress had required all competitors to complete ALL tests to be eligible for purchase. (It didn't matter that the aif force was 100% responsible for the crash.)
Much is also made of Boeing's financial losses - the company had invested heavily in the prototype. But this wasn't the first such loss, it was the last. Under the Air Corps Cooperative Airplane Program (again, Congress's plan) designers built and delivered prototypes out of their own pockets. Successful prototypes could be purchased, or purchased with an order placed for preproduction aircraft, or ordered into production. Prototypes that failed often led to bankruptcies.
After the 299 crash, major companies began refusing to take such risks, especially for 4-engined bombers, and the ACCAP was terminated.
Cheers,
Dana