It's a matter of extent though, not absolutes. Hobby, experimental & light-commercial applications do not often need millions of units. If they don't, the difference between a $1 & $10 controller doesn't matter in the way the difference between $10 & $100 matters... in more cases than not. Other considerations (eg the dev already knows the more expensive platform, maturity, etc.) can easily override
High-volume swarm applications could change the reality. You need a nexus between low end and high volume. Swarms might be that. These aren't that common though, and "high volume and cheap" is usually a large company thing.
IE, if you browse around kickstarter, most microcontroller applications fit into OP's scenario. The cost of the microcontroller is not that operative. There are undoubtedly some exceptions.
I don't know how to build an $2 device. Especially given that in any small device I've designed, power management always took 30-60% of board space and device cost. You reach the upper bounds if it uses a Li-Po battery.
There is a big gap between powering a hobby device from a bench power supply and building an actual end-user solution.
EDIT: I'm reading the answers here and it's clear I did not clearly communicate what I meant. Taping a board to a bunch of AA batteries is not an actual end-user solution. Neither is hanging a couple of boards off a bunch of wires. I was talking about products, something you might expect to pull out of a retail box and use.
Those mentioning PoE clearly haven't designed a device that is powered with IEEE 802.3af-2003 :-) (I have, and I have the battle scars to prove it). PoE doesn't mean you can just connect the wires and call it a day.
Having built a Dash Button clone with an ESP8266:
1. Choose a microcontroller that will run on <3 volts, and power it directly from two AA batteries in series. You have neither the power budget nor the financial budget for anything more complicated than that.
2. Your microcontroller should spend 99.99% of its time in its lowest power sleep mode. When sleeping, the microcontroller should consume <10μA and the other, non-microcontroller circuitry should consume the same amount.
These are rock-bottom power levels, expect to remove any status LEDs, USB-serial converter/in-circuit debugger chips, and even linear regulators compared to a development kit.
You don't have to use an ESP8266 like I did - a more experienced guy might have chosen an MSP430 or something similar.
3. Given you can only leave sleep mode 0.01% of the time, i.e. 8 seconds per day, if it takes 1 second to connect to wifi, send a message and get an acknowledgement back, you can only do that 8 times per day. If you want to update more often, you'll need something faster to connect and send a message. This is why many smart home systems use 433MHz to a base station, rather than using wifi directly.
4. A $2 budget won't include a case until you're making fairly serious volumes. Repurpose something you were throwing out, or wrap it the circuit in electrical tape, or go over budget but declare victory as you could hit the target in larger volumes.
You might struggle to get an AA cell in them, though.
Putting WiFi on a sensor makes no sense when you still have to run a power wire.
If you think about it most current IoT stuff blows. You need power for the device. And then you're using shit like WiFi for data. And even worse shit like Bluetooth for configuration. Security is a big big problem because it's brittle and conflicts with consumers need for stuff to just work. PoE solves all of those issues.