Minerals aren’t “free” not just because of the time investment, but because mining minerals is simply an exercise in gaining assets.
It doesn’t matter what assets you use to purchase something, what matters is their actual value, and it is a mistake to think the value of ore or minerals changes based arbitrarily on how you spend them.
If you mine ore that has a sell value of 100k, and use them to make a ship that costs less than the ore’s sell value, you lost out on value by deciding to produce something with that ore.
That doesn’t mean mining is always a bad deal (though refining in highsec usually isn’t a good deal and generally reduces the value of your ore because the mineral output you get is less valuable in price than the raw rock being sold on market to someone who has the ability to refine it more efficiently than you) but it does mean you should always think of ore as Isk in your pocket, rather than rocks that are “Free.”
That means when evaluating if you should further refine your materials (ore into minerals, minerals into equipment for example) you should always see how much value you gain/lose by just selling your current step and buying the next step. If you can refine your 100k ore into 101k of minerals, you should do so, but if you can only refine it into 99k of minerals, you should sell the ore and just buy minerals.
While it is technically true that your ore doesn’t cost you much of anything to get, the statement “it was free and thus your making 100% profit on what you make” isn’t true, because the second the ore is yours it has a value, and if you make it into something, your deciding to not sell it.
Put another way, if you found as a rat drop a rare officer mod, and were offered to trade it for a fully fit T1 ship, would you ever consider that trade “100% profit” because it didn’t cost you anything to get that officer mod? Of course not, because the second that officer mod is in your hold the value of your hold to sell dramatically shot up. Same with mining.
As for “Why to mine” it depends on where you are. In w-space and to an even greater extent nulsec corps often ore miners are needed to help handle everyone’s equipment, as industry becomes your corp’s lifeline. For highsec mining, the isk-hour is bad, but miners don’t require attention that much, allowing player miners to make some isk while doing something else, making it a “semi-passive” form of income. That means the supply of minerals and ore is almost always extremely high, with more materials being produced than being used. This means, in general, industrialists are better off directly purchasing minerals rather than mining it themselves because the isk cost of materials is extremely low. If, for some reason, mining got more difficult and less passive, less people would do it and thus material usage compared to material production would rise, and thus the value of minerals would go up. However this would also encourage more people to seriously mine, which would help stabilize material production.
Basically mining is easy, safe, and doesn’t require a lot of skill to do. Economics 101 tells us therefore that there will be far more miners than strictly needed and that the expected income of miners will be relatively low, because the barrier of entry and difficulty encourage a lot of people to go to it as an income source when they are unable or unwilling to do more skill or risk intensive jobs.