Sentences 1 and 2 have exactly the same meaning. The verb ask like many other ditransitive verbs has a variation with a prepositional phrase complement instead of two objects, like give, supply, etc.
Mark gave [John] [the bread].
Mark gave [the bread] [to John].
Mark supplied [us] [weapons].
Mark supplied [us] [with weapons].
Mark asked [John] [a question].
Mark asked [a question] [of John].
Sentences number three and four are an example of if with the same meaning as whether.
Similar constructions are to be found, e.g.
But as he had long been unhappy with the Viennese reception of serious
art, he was reluctant to risk a concert, and made an inquiry of Berlin
whether a performance of the mass and the symphony might be given
there. (Biography of Beethoven. Biography from Grove / Kunst der Fuge)
Somewhat more common is the noun inquiry taking only an interrogative content clause as complement, e.g.
In response to an inquiry whether she had ever been arrested, Lola
states that she was arrested five years earlier for fraud in
unemployment benefits. (Policy Guidance on the Consideration of Arrest Records - EEOC)
Though rare, these do also occur with if instead of whether, e.g.
But notwithstanding the presence of two beautiful girls, one the
fairest blonde, the other the brightest brunette, and both kind and
affable in their manners to him, the young man was restless and
anxious, until at length, with fierce blushes and faltering tones, he
expressed a hope that Mrs. Grey was well, and made an inquiry if
she were in. (Victor's Triumph Sequel to A Beautiful Fiend, Southworth, Emma Dorothy Eliza Nevitte, 1819-1899)
We want to now make an inquiry of you if you are standing by and
reaffirming that written waiver of trial by a jury and submit to be
tried by the panel of three judges who are seated here? (Supreme Court of Ohio, May 17, 197854 Ohio St. 2d 263 (Ohio 1978))
Overall, these seem rather formal in a present-day context.
The variation with to also exists with the noun inquiry:
His contract of employment was entirely informal, and consisted of an
inquiry to him as to whether "you want to fish with me," and his
answer in the affirmative. (Domanich vs Doratich, The Supreme Court of
Washington, 24 Nov 1931)
The as to which introduces the interrogative content clause in this example is also a common variation in these constructions.
In sum, replacing if with whether would probably make sentence 4 more acceptable, but there are precedents for similar usage as it stands.