Mass Airflow Sensor

 I have a 95 Nissan Maxima that has been dying at idle and running rough.  A mechanic notified me that the mass airflow sensor is bad as, when he tapped on it, he could get the car to stall, which has been the car's problem.  I've looked online at purchasing a new MAF and am wondering about the great disparity in pricing.  On known car part sites one can be found for between $200-300.  On ebay I can find one for $40-70 with a lifetime warranty.  Is the reason for such price differences due to paying more for the brand name or is there really a difference in quality between them.  Also it's stated that the computer may need to be reprogrammed when installing a new MAF.  Is this something only the dealer can do?
 Another question:  I bought a replacement Engine Control Module on ebay, as a mechanic told me that "some of the circuits are fried", and am wondering if this is also causing my car to stall.  I recently replaced IAC, knock sensor, and fuel injectors.  The dealer said when replacing the computer (ECM) the keys would need to be reprogrammed, but I checked my car key and it doesn't show it as having a transponder.  Could the ECM replacement be something I could just install by unplugging the old one and plugging in the new one, or do I need a mechanic to do that for me?  Any assistance regarding the above issues would be greatly appreciated.  Thank you.

The main reason for the price difference between parts sites and eBay is that parts sites sell NEW and eBay sells new and USED, with the used stuff being the cheapest. MAF replacement on this car is plug-n-go. As far as the ECM, you need to insure it is flashed for your car’s options. Otherwise you could be chasing electronic ghosts with new problems popping up. I’m always leery about swapping out ECMs just because a mechanic has trouble with diagnosong an issue. Typically, when they fail, the car refuses to start or run. A bad ECM is easy to spot, no guessing needed.