They are chemically the same and since the active ingredient is identical they have the same medical effect as brand drugs.
Why generics are cheaper than brand?
A huge part of a brand drug price consists of research and development costs, and advertising. Drug companies that produce generic versions simply buy chemical ingredients and spend money on production. Thus they can sets lower prices on their products.