Restricted stock (along with its nearly identical twin restricted stock units, often called RSUs) is also usually granted without any cost to you. In some states a nominal amount must be paid (e.g., par value). Some private companies grant early exercise stock options, in which case you actually buy restricted stock.
Similarly, with an employee stock purchase plan (ESPP), while there is no cost or fee to participate, you do have a cost when you buy shares. These purchases usually occur on fixed dates with accumulated salary deductions.
For companies, stock grants, whether options, restricted stock, or ESPP discounts, are not free. Under rules established in 2005 by the Financial Accounting Standards Board (FASB), companies must recognize an accounting expense at grant for the "fair value" of all forms of stock-based compensation (see a related FAQ). In addition, there are the costs of designing and administering the plan.