You need to buy yourself a Weapon License if you want to buy legal firearms in legal gun shops.
Where can I buy my Weapon License?Edit
To get this License, un-like the other procedures, you MUST make an application in "San Fierro Police Department" ---> "Rectruitment Office" section on forums.
After making your application on forums, you will get a response by a high rank of SFPD. If your application is accepted, you will have to contact the Chief of SFPD on the SFPD Building.