Complex sentences can have modifiers whose meaning is ambiguous, and as a rule of thumb, in those cases, you should assume that any modifier is modifying the next word or phrase that makes sense. To illustrate, I'll just emphasize the modifier and the next word, as this is usually enough:
I am really sorry.
This sentence has the same meaning as I am sorry. The word really acts as an intensifier, indicating the degree to which he or she is sorry.
Someone may use the word in this way to indicate to the listener they realize what they have done is not a small thing, something that a simple apology may not be able to fix. You can swap the word really with another intensifier and get the same effect:
I am very sorry.
... has exactly the same meaning. Whereas:
I really am sorry.
If you follow the same logic as the first sentence, the word really is placed before am to emphasize that the speaker is truly in the state of being sorry. With the placement of the intensifier, the speaker is drawing attention to the fact that he or she is sorry over the degree to which he or she is sorry.
Someone may use the word in this way when they are trying to indicate that they are sorry, and how sorry they are is not as important as making sure the listener knows they are sorry. It may be indicating that this statement is sincere, not sarcastic or patronizing.
The difference between the two sentences might be even easier to understand if we were to combine the two sentences:
I really am very sorry.
In this case, not only is the speaker indicating sincerity ("really am") but also the degree to which he or she is sorry ("very" or "really sorry").
I also should note that this is assuming two native English speakers in dialogue. If one were speaking to a foreigner or a child, he or she may interpret both sentences the same depending on the context.