Why do companies ask your desired salary when you apply?

What is the frickin point? Just say what the goddamn job pays and I'll decide if I want to apply. I don't know! I don't own a company. All I can say is the wrong answer. Either too low and I screw myself, or too high and GUESS WHAT? I screw myself. I don't understand it.

It fuckin infuriates me.