You have to pay for Google Custom Search (CSE) unless you are OK with showing ads for other services on your site. You can accomplish something similar to CSE with a lot more flexibility by implementing Google's Search API.
Check out their example implementations, specifically the one about a simple search box.