When the sunlight hits the photovoltaic (PV) cells that make up the solar panels, the cells produce DC current which is transmitted to inverters. Inverters then convert the DC into AC current which your property usually uses.
The AC power then gets used by your property and the excess gets pushed back into the utility grid producing 'credit' to you. At times when your system is not producing enough for your property, you would be using the credit available through net metering.
You typically get a dollar to dollar for your solar energy, i.e. if your utility cost from utility is 18 c/kWh, then your credit will be the same (inclusive of energy cost, energy transmission, taxes, etc.).