Sigh. You really don't get economics at *all*, do you? (Dragonslicer, talking to you too.)
The very concept of "get away with raising the price" shows an incredible lack of understanding. The optimal price is a function of supply and demand. If a company charges less than the optimal price, they will make less money off their available supply than would otherwise be the case. If the company charges more than the optimal price ("oh my $DEITY they are getting away with it!") they will price themselves out of the range of some of their potential demand, and wind up with unsold supply. Both of these options reduce revenue, but there's nothing impossible about them; they're just bad for business.
Hopefully this is reasonably understandable. Of course, things get a bit more complicated when you consider the ways in which supply and demand can be manipulated. For example, setting a high price on a luxury can actually increase demand, up to a point, and if you have a monopoly you can restrict supply to keep prices (and profits) high as well. There's also funny, semi-irrational effects like customer/brand loyalty, where some people will voluntarily give one company a monopoly on their business.
What regulation does (at the first order) is add a new cost of doing business. This cost reduces the money a company has available to obtain supply. Thus, the balance of supply and demand shifts; when supply goes does, unless demand goes down commensurately, the optimal price goes up. The company does take less profit, yes, but (assuming demand stays constant), not by the full amount that the regulation costs them; their customers also pay more.
The catch is that demand for that company's product only remains constant when the price goes up if all of their competitors are subjected to the same regulatory cost and commensurately raise their prices as well. If not - for example, if one company is subjected to a charge that all the others are not, and they compete for the same customers - then the company being regulated will lose about that much in profit. They will probably be able to recoup some of that by accepting lower supply but raising prices a little and relying on their loyal customers to keep buying that supply, but they will end up with less money.
Mind you, it should come as no surprise that regulation, when viewed from the perspective of a single established company, is pretty much always bad. View it from other perspectives, though, and it can be quite good. A company that wants to break into a monopolized market may be able to undercut the regulated competition. A potential customer who was previously not served due to being insufficiently profitable (not unprofitable, just not maximally profitable for the company) may now be able to purchase goods or services. Somebody who was completely unrelated to the company but was being harmed by an externality of its business (for example, environmental pollutants) will have their life improved.