Read this article : Safari for Mac: Manage cookies and website data using Safari
Do the settings accordingly as per screen shot .
You can delete cookies , by taking cursor on top menu bar > scroll down and click on Clear History , a pop window appears , click on drop down arrows and and select all history from the options , finally click on clear history .
This will delete all previous history and website data ( stored in the form of cookies ) .
And , if you enter into user library : macOS Sierra: Library folder
Find a Folder Safari , here you will find Databases and Local storage the contents are not to be removed unless some safari issues are there .
If you are using normal browsing , cookies will always be stored when a website is browsed , you can not stop websites to stop websites storing cookies as cookies are required for a website to run .
Perhaps , in Mac computer a feature is there for Private browsing , by enabling it permanently cookies will never be installed in the computer .
You can open safari and its preferences , click on general safari opens with and click on drop down arrows and choose a new private window .
An article for it : Safari for Mac: Use Private Browsing windows in Safari
And , regarding factory reset , the cookies will go away , but that is temporarily solution , once again you browse any website cookies will be hundred percent stored , thats the reason many users prefer private browsing .