When a device plays noise and has a microphone, then the manufacturer uses a digital signal processing technique called \"echo cancellation\" to subtract the noise it makes from the sound picked up from the microphone. This includes phones, headsets, your computer (skype does echo cancellation in software), and the Amazon Echo.
There are lots of questions about echo cancellation on SO, which you can easily find now that you know the magic words. The algorithms are too complex for an SO answer, but you can generally get an open source implementation for whatever environment you're working in. 59ce067264